Wednesday, February 1, 2012

Users and Groups in Linux - 1

Users :
Linux is Multi user environment. The users are those who can access the operating system resources with proper permissions as defined already.

Types of users :
I.   System Users
II.  Root User
III. Normal Users

I. System Users - They are default user in linux for some system process and service.
II. Root User - Root user is administrator of Linux System. He have all rights in machine. So should be very carefully with root user. Unknown mistakes may crash the system.
III. Normal Users - They are created by us for some reasons. They are limited users.

Groups : 
Groups are Logical experiences for tying users together. Normally groups are used to share files and permissions.

Types of groups :
I.   System Groups
II.  Root Group
III. Normal Groups

I.   System Groups - They are default groups in linux for some system process and services.
II.  Root Group - Root group is administrator group of Linux System.
III. Normal Groups - They are created by us for some reasons. They are limited groups.

Create User :
Normally we won't and can't create System users, It'll be created by system and or applications for services and maintainable. Root user will be created at the time of Linux installation.
for create a normal user we'll use the command "adduser".
We can use adduser command with root user only.

"useradd" command used to create a user. 
"passwd" command used to create password for user.

Ex.
[root@server ~]# useradd user1
[root@server ~]# passwd user1
user1

* Typed password won't be shown at terminal window
** Won't ask for password conformation for second time with root. (re enter password)

Create Group :
It also same as user. But When we create a user, the group for the user will be created with same name. A user must be with in a group. Two basic classifications in groups.

i   Primary Group
ii  Secondary Group

Primary Group - The user should be created with this group. He have all rights with in this group.
Secondary Group - The user may or may not have secondary group. And he may or may not have full rights with in this group.

"groupadd" command used to create a group.
Ex.
[root@server ~]# groupadd group1

User ID & Group ID
UID stored in /etc/passwd
GID stored in /etc/group

UID and GID are unique number for users and groups.
User and Group ID start with 0 and end with 65535.
0 - root user and group
1 - 500 for system users and groups
501 - 60000 for Normal user and groups
60001 - 65535 for duplicate user and group id.
A user can be assigned with multiple ID and these multiple ID numbers are chosen from this range of Duplicate ID range.

* Use man pages for more help.


While searching about it i got following questions :
i      How to create user without group ?
ii     How to create user with already created group ?
iii    How to create user without password ?
iv    How to create user with more groups ?
v     Is possible to change primary group of user ?
vi    How to remove user from the group ?
vii   How to delete a user ?
viii  How to delete a group ?  
ix    How to make a user as root privileged ?
x     Is it possible to edit passwd / group file manually ? And it take affects in user and group ?
xii   Is it possible to create a user without user directory and how ?

No comments: