8. how to create a user


Types of User: 
1. Normal
2. Admin

User contains username (for admin understanding) & user ID(for kernel understanding)
Syntax to create a user:
#useradd -u<uid> -g<gid> -G<gid> -d /export/home/<home dir> -m -s /bin/kshell <username>

ex: #useradd -u 1166 -g gram -G gramsci -d /export/home/jack -m -s /bin/sh jack
64 blocks

specification:
1. -u: used to specify user ID
2. -g: primary group ID
3. -G: secondary group ID
4. -d: to specify the default home directory
5. -m: to create a dir when directory not present
6. -s: to specify shell

minimum fields required to create a normal user:
ex;
# useradd -d /export/home/shiva -m shiva
# cat /etc/passwd

note:
1. when you create a user by default one file is gets updated automatically
/etc/passwd
2. when you create a user without specifying the primary group, by default it will be linked to default group that is "others". it is a system defined group, and whose gid=1 always.
3. If we do not specify the 'uid' while creating a user, it will take the increament value of the highest uid and if you don't specify a shell it will take defaultly /bin/sh.

ex:
#useradd -d /export/home/sita -m sita
64 blocks (32 kb)
1block = 512 bytes
2block= 1kB

#cat /etc/passwd
jack:x: ->'x' indicate password but it will not store password