centos 常用用户操作

查看用户组:sudo cat /etc/group

查看系统中有哪些用户:cut -d : -f 1 /etc/passwd

查看可以登陆系统的用户:cat /etc/passwd | grep -v /sbin/nologin | cut -d : -f 1

查看用户:w(前提切换到root用户)

who  

w -h

w -s

who | cut -d' ' -f1 | sort | uniq

users

whoami

id -un

who am i

who mom likes 

创建新用户:useradd centos

设置密码:passwd centos

查看IP:ip addr  

或:ifconfig

 然后ssh 登陆新用户:ssh  -q -l centos -p 22 140.143.246.13

切换到root:su root 

sudo -i

查看用户登陆历史记录:last
 

猜你喜欢

转载自blog.csdn.net/liming066/article/details/81517042
今日推荐