How to add/remove an user in Linux OS?
sudo is a one command which is used to rule all other commands in linux. sudo stands for
Super User Do
So you can say sudo is made by first characters of these three words. Some time an error “access denied” appears in your terminal, well sudo is solution to those commands. You need to add a keyword sudo at begging of these type commands.
To use sudo commands you should be super/ administrator /power user else you will come up with an error
How to check number of users associated with your system ?
As we know, a single computer system can be accessed by multipal user. Mainly there are two way to access a computer system by multipal users which are as follows:
- By using Guest Session
- By using your own account.
You can check number of user in your computer under setting button ( right-top corner in Ubuntu ).
Although there are some commands to check number of user but by using those commands you can find only logged in users at time. which are as follows
users: This command is used print the user names of users currently logged in to the current host
finger: If no arguments are specified, finger will print an entry for each user currently logged into the system.
finger with options
- $finger -lmps
Description of -lmps
- -l: Login time is displayed as month, day, hours and minutes, unless more than six months ago, in which case the year is displayed rather than the hours and minutes. Unknown devices as well as nonexistent idle and login times are displayed as single asterisks.
- -m: Provides information about phone number as eleven digit are printed as “‘+X-XXX-XXX-XXXX” as well as m gives information about mail status as “No mail ” if there is no mail at all, ‘‘Mail last read DDD MMM ## HH:MM YYYY (TZ)’’ if the person has looked at their mailbox since new mail arriving, or ‘‘New mail received …’’, ‘‘ Unread since …’’ if they have new mail.
- -p: Prevents the –l option of finger from displaying the contents of the “.plan“, “.project” and “.pgpkey” files.
- -s: Looks up for same user name. All name matching performed by finger is case insensitive.
who: This command shows currently logged in users , where who-u shows currently logged in user with time details
How to add a user in Linux ?
As above I have shown that there are only two users in my system by namely ramesh and Guest Session. More then two users can be required when you works in group and everybody needs different user in system. A new user can be added as follows
- To add a new user you must be a super /administrator /power user .
$sudo adduser paperguide
To check you newly added user
- You can see it at lock screen
- Click on setting icon (top-right corner in Ubuntu)
By using command $sudo adduser paperguide you have added a new user in your computer or server which can be seen as above step. But this new user don’t have root privileges. To make it a super/administrator/ power user you need to follow either some steps or commands which are as follows:
Method 1: By using command
Method 2: manual process
- First of all you should be login through super user.
- Click on system setting icon or search your computer by typing ‘system setting’.
- You need to search for user accounts under setting button.
- In this step first you need to check whether you are administrative user or not. You will be able to unlock setting only if you are a administrative user. See below
- Now, you have select account type.
- Congratulations!!!!!!!!!!!! Now you are administrative user.
Test sudo access on new user account
- Use the su command to switch to the new user account.
In above image it can be seen that you have changes from ramesh@ramesh to paperguide@ramesh . And now you are accessing ramesh’s home through your newly added user paperguide.
- To come out from this user you need to type exit in terminal.
Similarly you can make administrative user to standard (regular) user
- Click on setting or do search from computer button
- Now click on user accounts
- After selecting this option you need to click on the desired user (which you want to change) meanwhile you also need to unlock settings.
- finally, you need to change account type and do lock settings.
- Now user will be a standard user
You can make a standard user by using a small command as well, which is as follows
$sudo deluser user_name sudo
How to remove a standard or administrative user ?
Some time you need to remove an user from you computer or server. It can be performed as follows
$sudo deluser user_name
I am pleased to inform that you can also write articles for PaperGuide. Visit our page Join PaperGuide for more details or send your detailed resume along with a sample article ( atleast 1000 words ) at email@example.com.