Linux User Commands Tutorial: Administration & Management
As Linux is a multi-user operating system, there is a high need of an administrator, who can manage user accounts, their rights, and the overall system security for User management in Linux.
You should know the basics of Linux admin so that you can handle the user accounts and usergroups for user management in Linux.
Creating a User
In Linux, every user is assigned an individual account which contains all the files, information, and data of the user. You can create multiple users in a Linux operating system using Linux user commands. Next in this Linux admin tutorial, we will learn how to create a user in Linux Administration. The steps for creating a user are:
Using Terminal
Step 1) Use command sudo adduser
Step 2) Enter password for the new account and confirm
Step 3) Enter details of the new user and press Y
New account is created.
Click here if the video is not accessible
Using GUI
Step 1) Go to the system settings look for an icon which says ‘User Accounts’.
Step 2) Click on the unlock icon and enter a password when prompted, then click the plus sign.
Step 3) A new window would pop up, asking you for adding information to the new user account.The account type offers two choices – standard and administration(Ubuntu Limitation). If you want the new user to have administrative access to the computer, select Administrator as the account type. Administrators can do things like add and delete users, install software and drivers, and change the date and time. Otherwise, choose standard.Fill in the full name, username and click on create.
Step 4) The new account would show, but would be disabled by default.
To activate it, click the password option and add a new password. Click change to enable the account.
Deleting, disabling account
Terminal
For disabling an account using Terminal, remove the password set on the account.
sudo passwd -l 'username'
To delete an account, use the command –
sudo userdel -r 'username'
GUI
Step 1) Highlight the user account and click the minus sign to delete.
Step 2) For disabling click on the area where the password is stored, and you would get the following prompt. Select disable this account and click on change.
Adding users to the usergroups
You can view the existing groups on your Linux operating system by entering the following Linux user commands:
groupmod "Press Tab key twice"
Now to add a user to a group, use the following syntax:
sudo usermod -a -G GROUPNAME USERNAME
The system would ask for authentication and then it would add the user to the group.
You can check whether the user is in a group by this command.
And it would show it as
Removing a user from Usergroup
Use the following syntax for removing a user.
sudo deluser USER GROUPNAME
The GUI method
If you do not want to run the Linux user commands in terminal to manage users and groups, then you can install a GUI add-on .
sudo apt-get install gnome-system-tools
Once done, type
users-admin
Check user settings, and a tab Manage Groups will appear-
Finger
This command is used to procure information of the users on a Linux machine. You can use it on both local & remote machines
The syntax ‘finger’ gives data on all the logged users on the remote and local machine.
The syntax ‘finger username’ specifies the information of the user in User administration in Linux.
Linux/Unix user management commands
User management in Linux is done by using Linux administration commands. Here is a list of user management commands in Linux:
Command | Description |
---|---|
sudo adduser username | Adds a user |
sudo passwd -l ‘username’ | Disable a user |
sudo userdel -r ‘username’ | Delete a user |
sudo usermod -a -G GROUPNAME USERNAME | Add user a to a usergroup |
sudo deluser USER GROUPNAME | Remove user from a user group |
finger | Gives information on all logged in user |
finger username | Gives information of a particular user |
Summary:
- You can use both GUI or Terminal for User Administration in Linux User management
- You can create, disable and remove user accounts using Linux admin commands.
- You can add/delete a user to a usergroup.