Thursday, August 18, 2011

User accounts in Linux

Super User in Linux

Super User is the user with all rights for accessing all files, Like Windows Administrator. Here the super user is "root".

This user have all rights to access all files including system files. Should be careful if you are root. It can delete any files. So it may crash total system.

The root user can be created at the time of installation.


Adding User in Linux

The root user can add user to Linux box. Following command can be used for adding user in Linux.

[[email protected] ~]#useradd kumar

For setup password, Following command can be used,

[[email protected] ~]#passwd kumar
Changing password for user kumar.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

You'll get a warning message if you give any dictionary word.
"BAD PASSWORD: it is based on a dictionary word"

You can create user without password, also can disable password for a user. Passwordless account.

[[email protected] ~]#passwd -d kumar
Removing password for user kumar.
passwd: Success

For more details use man pages of useradd and passwd.

Every user have home directory as the user name, location is /home/{user name}.


Delete User

Following command is used to delete user,

[[email protected] ~]#userdel kumar

It delete user alone, home directory will be avaliable in /home/

For delete home diectory of the user, we use the option -r.
For delete the user forcely , we use the option -f.


User Groups

We can add groups in Linux, Groups are used for permission to accessing files and security. Group have one or more users.

For add group,

[[email protected] ~]#groupadd adminnote

When we create a user it automatically create group in the same user name. Every users must be in group, Every user have one primary group and may or may not secondary group. For Example, kumar is the user and he should be in the group kumar, It's primary group of the user kumar. And the user kumar may or may not in the group adminnote.

For checking group of the user, try following command.

[[email protected] ~]#groups kumar
kumar : kumar

For more details about this refere some Books of Linux.

No comments: