用戶功能finger

用戶功能

查閱更多的用戶相關信息命令:finger

語法: finger [-s] user_name

-s:僅列出用戶的賬號,全名,終端機代號與登陸時間

-m:列出後面接的賬號相同者,而不利用部分對比(包括全名部分)

例子:

[root@localhost ~]# finger xx
Login: xx                               Name:
Directory: /home/xx                     Shell: /bin/bash
Never logged in.
No mail.
No Plan.

新建自己的計劃文檔:

[xx@localhost ~]$ echo "i will have anice day" >~/.plan
[xx@localhost ~]$ finger xx
Login: xx                               Name:
Directory: /home/xx                     Shell: /bin/bash
Never logged in.
No mail.
Plan:
i will have a nice day

 單獨使用finger命令時,列出目前登陸到系統的所有用戶和登陸時間

[xx@localhost ~]$ finger
Login    Name        Tty      Idle Login Time   Office     Office Phone
whx      centos6.9   tty1     1:00 Oct  9 18:18 (:0)
whx      centos6.9   pts/0          Oct 9 18:19 (192.168.21.1)


修改用戶相關信息命令chfn

語法:chfn [-foph] [user_name]

 -f:後接完整的全名

 -o:後接辦公室號碼

 -p:後接辦公室電話號

 -h:後接家庭電話號

例子:

[xx@localhost ~]$ chfn
Changing finger information for xx.
Password:
Name []: xx for test
Office []: guiyang
Office Phone []: 11111
Home Phone []: 11111
 
Finger information changed.
[xx@localhost ~]$ finger xx
Login: xx                               Name: xx fortest
Directory: /home/xx                     Shell: /bin/bash
Office: guiyang, x1-1111                Home Phone: x1-1111
Never logged in.
No mail.
Plan:
i will have a nice day
[xx@localhost ~]$ grep xx /etc/passwd
xx:x:501:501:xx fortest,guiyang,11111,11111:/home/xx:/bin/bash
xxx:x:502:502::/home/xxx:/bin/bash

 

更改shell命令chsh

語法:chsh [-ls]

-s:設置修改自己的shell

-l:列出目前系統上可用的shell

[xx@localhost ~]$ chsh -l
/bin/sh
/bin/bash
/sbin/nologin
/bin/dash
/bin/tcsh
/bin/csh
[xx@localhost ~]$ chsh -s /bin/csh
Changing shell for xx.
Password:
Shell changed.
[xx@localhost ~]$ grep xx /etc/passwd
xx:x:501:501:xx fortest,guiyang,11111,11111:/home/xx:/bin/csh
xxx:x:502:502::/home/xxx:/bin/bash
[xx@localhost ~]$ chsh -s /bin/bash
Changing shell for xx.
Password:
Shell changed.
[xx@localhost ~]$ ll $(which chsh)
-rws--x--x. 1 root root 20056 Mar 22  2017 /usr/bin/chsh
[xx@localhost ~]$ id xx

 

查看用戶的uid,gid等信息命令id

語法:id [user_name]

不添加用戶名時,列出當前用戶的信息

例子:

[xx@localhost ~]$ id
uid=501(xx) gid=501(xx)groups=501(xx),500(whx),503(testgrp) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[xx@localhost ~]$ id whx
uid=500(whx) gid=500(whx)groups=500(whx),501(xx),503(testgrp)


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章