Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Linux+ Certification Bible.pdf
Скачиваний:
46
Добавлен:
15.03.2015
Размер:
3.78 Mб
Скачать

Chapter 9 General Linux Administration 297

The chsh command

Use the change shell command, or chsh, to change a user’s default shell only. This allows only the shell to be changed and uses the options shown in Table 9-4.

 

Table 9-4

 

Options for chfn

 

 

Option

Description

 

 

-s <shell>

Specifies the login shell.

 

 

-l

Lists the available shells in /etc/shells.

 

 

-v

Prints version information.

 

 

-u

Prints usage message.

 

 

--help

Provides program help.

 

 

Deleting users

4.1 Create and delete users

Use the userdel command to remove users who no longer require access to a system. The userdel command doesn’t have many options. The format of this command is userdel <login>, where <login> is the user’s account name. The only option for the userdel command is -r, which, when implemented, removes the user’s files in the home directory and the user’s mail spool. Files are often not removed in order to allow restoration of a user and access to the user’s files if necessary.

Creating groups

4.3 Create, modify and delete groups

You can create groups by using the groupadd command. The creation of a group uses the options shown in Table 9-5.

298 Part IV Administration

 

Table 9-5

 

Options for groupadd

 

 

Option

Description

 

 

-g <gid>

The <gid> is a numerical value assigned to the group. 0-499 are normally

 

used for system accounts; therefore, 500 and above are used for newly

 

created groups.

 

 

-r

Instructs the groupadd command to add a system account.

 

 

-f

Prevents groupadd from exiting with an error when a group already exists

 

on the system.

 

 

-o

Allows non-unique <gid> to be used with the -g option.

 

 

--help

Provides program help.

 

 

The syntax for the groupadd command is: groupadd <groupname>. This command writes to the following files:

/etc/group: Contains group account information

/etc/gshadow: Contains secure group account information

The groupmod command

4.3 Create, modify and delete groups

Use the groupmod command to adjust previously created groups. The groupmod command has only a few options. The -g <gid> is used to change the group identification number and must be unique unless the -o option is used. When this command is used, all files that are associated with the old group ID must be manually modified to reflect the new group ID. The -n option is used to change the name of a group and uses this format: -n <new group name>. Use this option, for example, to change the name of an existing group to a more representative name, or in the

enterprise world, to a new organizational name. This command writes to the following files:

/etc/group: Contains group account information

/etc/gshadow: Contains secure group account information

The groupdel command

4.3 Create, modify and delete groups

Соседние файлы в предмете Операционные системы