SES by degreeadvantage.com

Saturday, October 6, 2007

Users and Groups

User and Group Administrator

There are three type of user account in Red hat Linux

    1. Super user or Administrative account
    2. Regular user account
    3. service account
  1. Super User created automatically at the time of installation
  2. Regular user Account;
  1. Using command line method ‘useradd’ or ‘adduser’ command
  2. Graphical method by using Red hat user manager utility

a.

# adduser user_name (Recommended : minimum 6 character used in password)

# passwd user_name

Example:

#adduser abc

#passwd abc

Now open the file /etc/passwd to check the entry of user

#vi /etc/passwd

it contain 7 entry of each user

  1. Username
  2. Password
  3. userid
  4. groupid
  5. blank (User information field ) comment
  6. home directory
  7. login shell

password entry for each user will be stored in /etc/shadow

# vi /etc/shadow

now in order to check the Userid, Group we use /etc/login.def

# vi /etc/login.def

when any user account is created then user will get userid, groupid automatically from /etc/login.def

5th field is used for user information or comment

6th field is used for home directory. When any user is created its default home directory is created inside /home

/home/abc

7th field is login shell. Default shell for user is /bin/bash

different shells are used

ksh, sh, csh, tcsh,zsh

shell is an user interface between user and O.S. linux command shell is a prompt that allow us to interact with our system by executing various command.

In order to check the shell available use /etc/shells

# vi /etc/shells

in order to get the information about the group we need /etc/group

#vi /etc/group

it contain four field

  1. Group name
  2. password
  3. GroupId
  4. Member of group

# finger : this command is used to get the information about the user

Syntax:

#finger username

#finger abc

#id : this command is used to get userid, groupid of the user

syntax:

#id username

#id abc

Creating Group:

Syntax:

#groupadd groupname

#groupadd –g gid groupname

Example:

#groupadd abc

Exercise:

Create a user that should have uid=1000 shell=sh description and home directory as /data

Sol:

#useradd –u 1000 –c abc –s /bin/sh –d /data abc

#passwd abc

Grpahically

System Setting :-> User & Group

OR

#system-config-user

Every user have two group one is elementary group or primary group and secondary group

-g : Primary Group

-G : Secondary Group

Creating Group

#groupadd g1

#groupadd g2

Steps:

1. adding group to the user

#usermod –g g1 –G g2 abc

2. To change id of the user

#usermod –u 1001 abc

3. change comment

#usermod –c xyz

4. change home directory

#usermod –d /abc-home abc –m

5. change shell

#usermod –s /bin/bash abc

6. change user login name

#usermod –l newname oldname

#usermod –l xyz abc

7. Change Group name

#groupmod –n newname oldname

#groupmod –n group1 g1

8. change Group id

#groupmod –g 2005 group1

No comments:

 
Free Search Engine Submission thanks to: Create a Website