Restricted User Accounts Users and Secondary Groups

Another issue to contend with is the need to test and sometimes to recreate a users environment. Although environment customization is supposed to be done by the user, sometimes it is better if the system administrator does this; often, users are not knowledgeable enough to perform this task. By using the su − username command please note the hyphen character, the superuser can switch to a user account and create a real user environment; it is just the same as when the user logs into the system, except password verification is not required for the superuser. It is extremely useful to have the users credentials while debugging the users account. The need to add a user to some other UNIX facilities in use at a specific site is also possible. Additional administrative activities can also be required in, for example, assigning disk quotas, defining mail aliases, setting print queue access, etc.

7.2.1 Restricted User Accounts

Some users are allowed only restricted use of the system. One example of a possible restriction on user access is a user who has access only to execute a single application program. Such demands are addressed by a captive account. In this case, the application program itself replaces the UNIX shell that usually enables full use of the system. Entries for these restricted users must be created in the etcpasswd file, or existing entries must be modified. Once the login process for such a user is successfully completed, the specified application program begins to execute; once the program is completed, the user will automatically be logged out. Unfortunately, not all programs can be used in this way; if the program requires interactive use for example, input of a variable is required then sometimes simply using the program instead of the login shell will not work. UNIX provides a restricted shell to address such demands. A restricted shell, specified as rsh, represents a modified version of a regular shell in which some of the dangerous UNIX commands are disabled the term dangerous should be read considering the alternative, unrestricted use of the shell. This means that the cd change directory command is disabled, as are other commands designed to take the user out of the current directory. In this way, a user stays only in the home directory, has a restricted number of available UNIX commands sufficient to perform a specific job, but does not have the usual control over the system. Another possible way to keep a user within the application is to execute the application program within the user login initialization file. Such an approach could be easier to manage a specific user environment can be set first, and then the application started, but is more difficult to keep secure; a user could try to find a bypass during the login procedure to reach the shell.

7.2.2 Users and Secondary Groups

Assigning users to an additional group, or even several groups, is a very common task. Only the users primary group is defined in the etcpasswd file; membership in additional groups, known as secondary groups, is specified in the group file etcgroup. There is no difference between primary and secondary groups regarding group ownership and access permissions; the only difference between them is the way they are specified the etcpasswd file versus the etcgroup file. The BSD platform has never distinguished between primary and secondary groups except for accounting purposes; however, the System V platform originally allowed a user to have only one 178 The groups command can be used to display group membership: groups username Lists groups that username belongs to groups Lists all users groups Alternatively, the id command that lists all of a users identification data could also be used: id −g username Lists groups that username belongs to id −g Lists groups that the user who invokes the command belongs to

7.2.3 Assigning User Passwords