Linux User Management Basics

Linux User Management Basics: A Beginner’s Guide

If you’re using Linux, knowing how to manage users is super important, especially if you’re running a server or sharing your system with others. It helps you keep things organized and secure. …


This content originally appeared on DEV Community and was authored by madhushan Herath

Linux User Management Basics: A Beginner's Guide

If you're using Linux, knowing how to manage users is super important, especially if you're running a server or sharing your system with others. It helps you keep things organized and secure. Let’s go over the basics of handling users in Linux!

1. Creating a New User

Adding a new user is easy! If you're on Ubuntu/Debian, use this:

sudo adduser username

This sets up a new user with a home directory and some basic settings.

For other Linux versions, try:

sudo useradd -m username

The -m flag makes sure the home directory is created.

2. Setting and Changing User Passwords

After adding a user, they’ll need a password:

sudo passwd username

If you need to change your own password:

passwd

3. Deleting a User

To remove a user but keep their files:

sudo deluser username

If you want to remove the user and their home directory:

sudo deluser --remove-home username

For RedHat-based systems:

sudo userdel -r username

4. Managing User Groups

Groups help organize users with similar permissions. To add a user to a group:

sudo usermod -aG groupname username

To see which groups a user is in:

groups username

To create a new group:

sudo groupadd groupname

To remove a user from a group:

sudo gpasswd -d username groupname

5. Understanding Linux File Permissions

Files and folders have permissions that control who can read, write, or run them. To check permissions:

ls -l

You'll see something like this:

-rw-r--r-- 1 user group 1234 Jan 1 12:00 file.txt
  • The first character (-) means it's a file (d means directory).
  • The next three (rw-) are for the owner.
  • The next three (r--) are for the group.
  • The last three (r--) are for others.

To change permissions:

chmod 755 filename

To change ownership:

chown user:group filename

6. Switching Users

To switch to another user:

su - username

Or use sudo to run commands as another user:

sudo -u username command


This content originally appeared on DEV Community and was authored by madhushan Herath


Print Share Comment Cite Upload Translate Updates
APA

madhushan Herath | Sciencx (2025-02-16T13:17:33+00:00) Linux User Management Basics. Retrieved from https://www.scien.cx/2025/02/16/linux-user-management-basics/

MLA
" » Linux User Management Basics." madhushan Herath | Sciencx - Sunday February 16, 2025, https://www.scien.cx/2025/02/16/linux-user-management-basics/
HARVARD
madhushan Herath | Sciencx Sunday February 16, 2025 » Linux User Management Basics., viewed ,<https://www.scien.cx/2025/02/16/linux-user-management-basics/>
VANCOUVER
madhushan Herath | Sciencx - » Linux User Management Basics. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/02/16/linux-user-management-basics/
CHICAGO
" » Linux User Management Basics." madhushan Herath | Sciencx - Accessed . https://www.scien.cx/2025/02/16/linux-user-management-basics/
IEEE
" » Linux User Management Basics." madhushan Herath | Sciencx [Online]. Available: https://www.scien.cx/2025/02/16/linux-user-management-basics/. [Accessed: ]
rf:citation
» Linux User Management Basics | madhushan Herath | Sciencx | https://www.scien.cx/2025/02/16/linux-user-management-basics/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.