• Aucun résultat trouvé

Modifying a user's working environment

Dans le document A / UX® Local System Administration (Page 106-110)

A/UX provides great flexibility in establishing and modifying a user's working environment.

Some of the more important parameters that can be modified are

• A particular user's ability to have access to the commands and data stored on the system

• The accessibility of a user's files and directories to other users

• The location or name of any user's home directory

• The command that the user employs as the shell

Distributed AlUX fde permissions

The system administrator can change the permissions of system command and data files so that no users, some users, or all users can have access to them. This is a responsibility that should be exercised with extreme caution, because giving write permission to all users on a file like /etc/passwd can have disastrous consequences.

Users can change the permissions associated with their own files. For a discussion about how to do this and what effects these changes have on users' ability to have access to the files, see

"File-Access Permissions," earlier in this chapter, and chmod(l) in A/UX Command Reference.

Moving a user

Sometimes it is necessary to move a user's working environment. There are a few ways of doing this, and the method you choose depends on the characteristics of the move. If you do move a user's files, remember to change his or her home directory in / etc/pas swd.

Chapter 3 User and Group Administration 3-29

Moving a directory

The simplest move is the one that involves moving a user's directory to another place in the same file system. The command line

mv old-dir new-dir

moves the old-dir directory (including all of its files, any subdirectories associated with it, and all of their files) to new-dir.

Using cp i 0 to move a user across rue systems

With cpio, which stands for "copy input to output," a directory containing files and subdirectories can be copied elsewhere on the system, with all files maintaining their original ownership, permissions, and modification time.

• Note: In the standard A/UX distribution on a Macintosh computer with an

SO-megabyte hard disk, the disk contains only one user-accessible file system-root.

The entire A/UX directory hierarchy and any specific hierarchy (such as /usr) are available on this file system.

If you have created a new file system (for example, located at /users2) on an external hard disk, you can copy all files and subdirectories contained in the directory / use r s / john to a directory /users2/john on the other file system. To do so, change to the /users

directory by entering

cd /users

and enter the following command:

find john -depth -print I cpio -pdm /users2

The parts of this command line are as follows:

find john -depth

Name of the command that gathers the filenames to pass to cpio.

Name of the directory from which to start the search.

Forces a depth-first search of the directory in order to control the order in which files are copied.

3-30 A/UX Local System Administration

-print

epio

p d

m

/users2

Prints each file or directory name found.

Connects (or "pipes") standard output of the previous command to standard input of the next command.

Name of the command that does the actual copying.

Character signaling that options follow.

Copies ("passes") the named files to a named directory.

Creates new subdirectories as needed.

Retains the original file's modification times.

Name of the new directory in which to place the files.

This moves a copy of the user's files to a new directory. Once you are sure that the move was successful, you can delete the original files.

This example shows how to move the user and is not a lesson on epio; see epio(1) in AlUX Command Reference. Remember that when you move the user's files, you should also change the user's home-directory field in / et e / pa s s wd and any other references to his or her home directory in files such as . profile.

Using tar to move a user across fde systems

While mv works only within the current file system, the tar (tape archiver) command can be used instead of epioto copy directories from one file system to another.

• Note: In the standard A/UX distribution on a Macintosh computer with an

80-megabyte hard disk, the disk contains only one user-accessible file system. The entire A/UX directory hierarchy and any specific hierarchy (such as /usr) are available on the root file system.

Chapter 3 User and Group Administration 3-31

If you have created a new file system (for example, one located at / use r s 2) on an external hard disk or a floppy disk, you can copy all files and subdirectories contained in the directory

/users to a directory /users2/ john on the other file system. To do so, enter the commands

cd /users

tar cf - john I (cd /users2i tar xf -)

The parts of this command line are as follows:

tar

Stores the image under the filename (or directory name) that appears next in the line.

When used with f, directs the image to the standard output.

Name of the directory to start copying from.

Connects (pipes) standard output of the previous command to standard input of the next command.

Parentheses enclose commands to be executed in a subshell.

Changes the subshell's current directory to /users2.

Command separator.

Command name.

Extracts file or files from the just-created tar image on tape or disk. The

tar command does so file by file; if the file is a directory, it is extracted recursively (that is, until it is exhausted of files and subdirectories).

Extracts the image from the following file.

When used with f, takes the image from the standard input.

When - stands for a filename, tar uses the standard output as a file with the x or t option.

3-32 NUX Local System Administration

\

This moves a copy of the user's files to a new directory. Once you are sure that the move was successful, you can delete the original files.

This example shows how to move the user and is not a lesson on tar; see tar(l) in A/UX Command Reference. Remember that when you move the user's files, you should also change the user's home-directory field in / et c / pa s s wd and any other references to his or her home directory in files such as .profile.

Dans le document A / UX® Local System Administration (Page 106-110)