WE CODE NOW
  • Home 
  • Blog 
  • Guides 
Guides
  1. Home
  2. Guides
  3. Linux Command Series
  4. Linux User and Group Management

Linux User and Group Management

Posted on June 1, 2024  (Last modified on June 8, 2024) • 2 min read • 217 words
Linux
 
User Management
 
Groups
 
Permissions
 
Linux
 
User Management
 
Groups
 
Permissions
 
Share via

Explore how to manage users and groups in Linux, including creating and deleting users, managing user permissions, and using sudo.

On this page
  • Managing Users
    • Creating Users
    • Deleting Users
  • Managing Groups
    • Creating Groups
    • Adding Users to Groups
    • Viewing Group Membership
  • Managing Permissions
    • Viewing Permissions
    • Changing Ownership
    • Changing Permissions
  • Using Sudo
    • Granting Sudo Access
    • Using Sudo
  • Conclusion

Linux User and Group Management  

Managing users and groups is crucial for system security and administration. This guide covers creating and deleting users, managing user permissions, and using sudo in Linux.

Managing Users  

Creating Users  

Use useradd to create a new user.

sudo useradd username

Set the user password.

sudo passwd username

Deleting Users  

Use userdel to delete a user.

sudo userdel username

Managing Groups  

Creating Groups  

Use groupadd to create a new group.

sudo groupadd groupname

Adding Users to Groups  

Use usermod to add a user to a group.

sudo usermod -aG groupname username

Viewing Group Membership  

Use groups to view a user’s group memberships.

groups username

Managing Permissions  

Viewing Permissions  

Use ls -l to view file permissions.

ls -l filename

Changing Ownership  

Use chown to change file ownership.

sudo chown user:group filename

Changing Permissions  

Use chmod to change file permissions.

sudo chmod 755 filename

Using Sudo  

Granting Sudo Access  

Edit the /etc/sudoers file to grant sudo access.

sudo visudo

Using Sudo  

Use sudo to execute commands with superuser privileges.

sudo command

Conclusion  

Effective user and group management is vital for system security and administration. Practice creating and deleting users, managing permissions, and using sudo to enhance your Linux administration skills.

 Disk Management in Linux
Linux Package Management 
On this page:
  • Managing Users
    • Creating Users
    • Deleting Users
  • Managing Groups
    • Creating Groups
    • Adding Users to Groups
    • Viewing Group Membership
  • Managing Permissions
    • Viewing Permissions
    • Changing Ownership
    • Changing Permissions
  • Using Sudo
    • Granting Sudo Access
    • Using Sudo
  • Conclusion
Copyright © 2024 WE CODE NOW All rights reserved.
WE CODE NOW
Link copied to clipboard
WE CODE NOW
Code copied to clipboard