生活随笔
收集整理的這篇文章主要介紹了
Linux常用命令:用户
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
軟件環境
- Linux:CentOS Linux release 7.6.1810 (Core)
用戶
[root@localhost ~]# cut -d : -f 1 /etc/passwd
// 方法一
[root@localhost ~]# useradd username
// 方法二
[root@localhost ~]# adduser username
[root@localhost ~]# passwd username
[root@localhost ~]# userdel username
// 刪除用戶的同時,也會把系統上的文件也刪除掉
[root@localhost ~]# userdel -r username
用戶組
// 查看所有用戶組
[root@localhost ~]# cat /etc/group
// 查看新增的用戶組
[root@localhost ~]# tail -1 /etc/group
[root@localhost ~]# groupadd usergroup
[root@localhost ~]# groupdel usergroup
// 修改用戶組名
[root@localhost ~]# groupmod -n new-usergroup usergroup
// 修改群組識別碼
[root@localhost ~]# groupmod -g 1002 usergroup
[root@localhost ~]# groups username
權限
[root@localhost ~]# su username
// 完全切換到新用戶(推薦)
[root@localhost ~]# su - username
[lemon@localhost ~]$ sudo opt
總結
以上是生活随笔為你收集整理的Linux常用命令:用户的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。