This is a list of the step-by-step instructions in this chapter.
Users frequently experience problems--and call on a system administrator for help--because they cannot access a program, a file, or a directory that they could previously use. Whenever you encounter such a problem, investigate one of three areas:
The user's search path may have been changed, or the directories in the search path may not be in the proper order.
The file or directory may not have the proper permissions or ownership.
The configuration of a system accessed over the network may have changed.
This chapter briefly describes how to recognize problems in each of these three areas and suggests possible solutions.
A message of Command not found indicates one of the following:
The command is not available on the system.
The command directory is not in the search path.
To fix a search path problem, you need to know the pathname of the directory where the command is stored.
If the wrong version of the command is found, a directory that has a command of the same name is in the search path. In this case, the proper directory may be later in the search path or may not be present at all.
You can display your current search path by using the echo $PATH command.
$ echo $PATH /home/kryten/bin:/sbin:/usr/sbin:/usr/openwin/bin:/usr/openwin/bin/xview: /usr/dist/local/exe:/usr/dist/exe |
Use the which command to determine whether you are running the wrong version of the command.
$ which maker /usr/doctools/frame5.1/bin/maker |
The which command looks in the .cshrc file for path information. The which command may give misleading results if you execute it from the Bourne or Korn shell and you have a .cshrc file than contains aliases for the which command. To ensure accurate results, use the which command in a C shell, or, in the Korn shell, use the whence command.
Display the current search path to verify that the directory for the command is not in your path or that it isn't mispelled.
$ echo $PATH |
Check the following:
Is the search path correct?
Is the command in one of the search paths?
If the path needs correction, go to step 3. Otherwise, go to step 4.
Add the path to the appropriate file, as shown in this table.
Activate the new path as follows:
Shell |
File Where Path Is Located |
Activate The Path With ... |
---|---|---|
Bourne and Korn |
.profile |
$ . ./.profile |
C |
.cshrc |
hostname% source .cshrc |
|
.login |
hostname% source .login |
Verify the path using the command shown below.
$ which command |
This example shows that the OpenWindows executable is not in any of the directories in the search path using the which command.
venus% openwin Command not found venus% echo $PATH no openwin in . /home/ignatz /sbin /usr/sbin /usr/bin /etc /home/ignatz/bin /bin /home/bin /usr/etc venus% vi ~.cshrc (Add appropriate command directory to the search path) venus% source .cshrc venus% openwin |
If you cannot find a command, look at the man page for its directory path. For example, if you cannot find the lpsched command (the lp printer daemon), lpsched(1M) tells you the path is /usr/lib/lp/lpsched.
When users cannot access files or directories that they previously could access, the permissions or ownership of the files or directories probably has changed.
Table 71-1 shows the octal values for setting file and directory permissions. You use these numbers in sets of three to set permissions for owner, group, and other (in that order). For example, the value 644 sets read/write permissions for owner, and read-only permissions for group and other.
Table 71-1 Octal Values for File Permissions
Value |
Description |
---|---|
0 |
No permissions |
1 |
Execute-only |
2 |
Write-only |
3 |
Write, execute |
4 |
Read-only |
5 |
Read, execute |
6 |
Read, write |
7 |
Read, write, execute |
Frequently, file and directory ownerships change because someone edited the files as superuser. When you create home directories for new users, be sure to make the user the owner of the dot (.) file in the home directory. When users do not own "." they cannot create files in their own home directory.
Access problems can also arise when the group ownership changes or when a group of which a user is a member is deleted from the /etc/group database.
Use the chown command to change file ownership.
# chown new-owner filename |
new-owner |
Is the specified user-name or UID of the new file owner. There must be an entry for the specified user-name in the passwd file. |
filename |
Is the specified file or directory. |
Use the chgrp command to change group ownership.
# chgrp new-owner filename |
new-owner |
Is the specified group ID or GID of the new group owner. There must be an entry for the specified group-name in the group file. |
filename |
Is the specified file or directory. |
List the file permissions.
# ls -l filename |
-l |
Displays the long listing, which includes current permissions for the file. |
filename |
Is the specified file or directory. |
# chmod nnn filename |
nnn |
Are numbers representing the permissions you are assigning to the file owner, the group owner, and all others, in that order. |
filename |
Is the specified file or directory. |
Permissions are changed using the numbers you specify.
You can change permissions on groups of files or on all files in a directory using meta characters such as (*) in place of file names or in combination with them.
Verify that the permissions have been changed by using the ls -l command.
$ ls -l filename |
The long listing shows the current permissions for the file.
This example shows changing the permissions of a public directory from 744 (read/write/execute, read-only, and read-only) to 755 (read/write/execute, read/execute, and read/execute).
$ ls -ld public_dir drwxr--r-- 1 ignatz staff 6023 Aug 5 12:06 public_dir $ chmod 755 public_dir $ ls -ld public_dir drwxr-xr-x 1 ignatz staff 6023 Aug 5 12:06 public_dir |
This example show changing the permissions of an executable shell script from read/write to read/write/execute.
$ ls -l my_script -rw------- 1 ignatz staff 6023 Aug 5 12:06 my_script $ chmod 700 my_script $ ls -l my_script -rwx------ 1 ignatz staff 6023 Aug 5 12:06 my_script |
You must own a file or directory (or have root permission) to be able to change its owner.
Become superuser.
List the file permissions.
# ls -l filename |
-l |
Displays the long listing, which includes the owner of the file, displayed in the third column. |
filename |
Is the specified file or directory. |
# chown new-owner filename |
Ownership is assigned to the new owner you specify.
Verify the file ownership change.
# ls -l filename |
# ls -l quest -rw-r--r-- 1 fred staff 6023 Aug 5 12:06 quest # chown ignatz quest # ls -l quest -rw-r--r-- 1 ignatz staff 6023 Aug 5 12:06 quest |
List the file permissions.
# ls -l filename |
Change the group that owns the file or directory.
$ chgrp GID filename |
The group ID for the file or directory you specify is changed.
Verify the file ownership change.
# ls -l filename |
$ ls -l junk -rw-r--r-- 1 kryten other 3138 Oct 31 14:49 junk $ chgrp staff junk $ ls -l junk -rw-r--r-- 1 kryten staff 3138 Oct 31 14:49 junk |
See Chapter 51, Securing Files (Tasks) for information about how to edit group accounts.
If users have problems using the rcp remote copy command to copy files over the network, the directories and files on the remote system may have restricted access by setting permissions. Another possible source of trouble is that the remote system and the local system are not configured to allow access.
See NFS Administration Guide for information about problems with network access and problems with accessing systems through AutoFS.