用户功能
查阅更多的用户相关信息命令: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)
本文出自 “天黑顺路” 博客,请务必保留此出处http://mjal01.blog.51cto.com/12140495/1971090
原文地址:http://mjal01.blog.51cto.com/12140495/1971090