User and group operations

2014-11-24 09:55:03 · 作者: · 浏览: 1

Explain some common operations of user and group by bash shell in Ubuntu.

List all the users and groups

List users

~$ less /etc/passwd

~$ more /etc/passwd

~$ cat /etc/passwd

List groups

~$ less /etc/group

~$ more /etc/group

~$ cat /etc/group

Create user and group

Create and remove a group

~$ sudo addgroup 
  
   

~$ sudo delgroup 
   
  

Create and remove a user

~$ sudo adduser 
  
System will create a same name group if you notice.
~$ deluser 
  
This user's primary group will be removed at the same time.

Add user to group

~$ sudo adduser 
   
   
  


For more details please reference Ubuntu official document: User Management