07.06.2014 Views

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8.4.3. Modifying an Existing Account or Password<br />

The following commands allow modification of the information stored in specific fields of the<br />

user databases: passwd permits a regular user to change their password, which in turn, updates<br />

the /etc/shadow file; chfn (CHange Full Name), reserved for the super-user (root), modifies the<br />

GECOS field. chsh (CHange SHell) allows the user to change their login shell, however available<br />

choices will be limited to those listed in /etc/shells; the administrator, on the other hand, is<br />

not bound by this restriction and can set the shell to any program of their choosing.<br />

Finally, the chage (CHange AGE) command allows the administrator to change the password<br />

expiration settings (the -l user option will list the current settings). You can also force the<br />

expiration of a password using the passwd -e user command, which will require the user to<br />

change their password the next time they log in.<br />

8.4.4. Disabling an Account<br />

You may find yourself needing to “disable an account” (lock out a user), as a disciplinary measure,<br />

for the purposes of an investigation, or simply in the event of a prolonged or definitive<br />

absence of a user. A disabled account means the user cannot login or gain access to the machine.<br />

The account remains intact on the machine and no files or data are deleted; it is simply<br />

inaccessible. This is accomplished by using the command passwd -l user (lock). Re-enabling<br />

the account is done in similar fashion, with the -u option (unlock).<br />

GOING FURTHER<br />

NSS and system databases<br />

Instead of using the usual files to manage lists of users and groups, you could<br />

use other types of databases, such as LDAP or db, by using an appropriate<br />

NSS (Name Service Switch) module. The modules used are listed in the<br />

/etc/nsswitch.conf file, under the passwd, shadow and group entries. See<br />

Section 11.7.3.1, “Configuring NSS” (page 290) for a specific example of the<br />

use of an NSS module by LDAP.<br />

8.4.5. Group List: /etc/group<br />

Groups are listed in the /etc/group file, a simple textual database in a format similar to that of<br />

the /etc/passwd file, with the following fields:<br />

• group name<br />

• password (optional): This is only used to join a group when one is not a usual member<br />

(with the newgrp or sg commands, see sidebar);<br />

• gid: unique group identification number<br />

• list of members: list of names of users who are members of the group, separated by commas.<br />

156 The Debian Administrator's Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!