Previous Table of Contents Next


CHAPTER 10
Recognizing File Access Problems

Recognizing Problems with Search Paths
Recognizing Problems with Permissions and Ownership

THIS CHAPTER DESCRIBES HOW TO RECOGNIZE PROBLEMS WITH SEARCH PATHS, permissions, and ownership.

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 used to be able to access. Whenever you encounter such a problem, investigate one of two 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.

This chapter briefly describes how to recognize problems in each of these areas and suggests possible solutions.

Recognizing Problems with Search Paths

If a user types a command that is not in the search path, the message Command not found is displayed. The command may not be found because the command is not available on the system or the command directory is not in the search path.

If the wrong version of the command is found, a directory with a command of the same name is in the search path. In this case, the proper directory may be found later in the search path or may not be present at all.

To diagnose and troubleshoot problems with search paths, follow this procedure:

1.  Display the current search path.
2.  Edit the file where the user's path is set (.cshrc or .login for the C shell; .profile for the Bourne and Korn shells). Add the directory, or rearrange the order of the path.


NOTE:  For the C shell, always check both the .cshrc and .login files to make sure the path information is set all in one place. Duplicate entries can make the search path hard to troubleshoot and make search times less efficient for the user.
3.  Source the file to activate the changes.
4.  Verify that the command is found in the right place.
5.  Execute the command.

The tasks you use to follow this procedure are described in the following sections.

Displaying the Current Search Path

To display the current search path, type echo $PATH and press Return. The current search path is displayed:

cinderella% echo $PATH
/sbin:/usr/sbin:/usr/bin:/etc
cinderella%

Setting the Path for Bourne and Korn Shells

The path for the Bourne and Korn shells is specified in the user's $HOME/.profile file in this way:

PATH=/usr/bin:/$HOME/bin:.;export PATH

The dot (.) at the beginning of the path specifies that the current directory is always searched first.

Sourcing Bourne and Korn Shell Dot Files

When you have changed information in the .profile file, you must source the file to make the new information available to the shell. To source the .profile file, type . .profile and press Return:

$ . .profile
$

Setting the Path for the C Shell

The path for the C shell is specified in the user's $HOME/.cshrc or .login file (with the set path environment variable) in this way:

set path =  (/usr/bin $home/bin .)

The dot (.) at the beginning of the path specifies that the current directory is always searched first.

Sourcing C Shell Dot Files

When you have changed information in the .cshrc or .login file, you must source the file to make the new information available to the shell. To source the .cshrc file, type source .cshrc and press Return. To source the .login file, type source .login and press Return:

castle% source .cshrc
castle% source .login
castle%

Verifying the Search Path

When you have changed a user's path, use the which command to verify that the shell is finding the proper command. The which command looks in the .cshrc file for information. The which command may give misleading results if you execute it from the Bourne or Korn shell and the user has a .cshrc file that contains aliases for the which command. To ensure accurate results, use the which command in a C shell. Alternatively, you can use the whence command instead of the which command from the Korn shell.

To verify the search path, type which command-name and press Return. If the command is found in the path, the path and the name of the command are displayed.

This example shows that the OpenWindows executable is not in any of the directories in the search path:

oak% which openwin
no openwin in . /home/ignatz /sbin /usr/sbin /usr/bin /etc
/home/ignatz/bin /bin /home/bin /usr/etc
oak%

This example shows that the executable for OpenWindows is found among the directories in the search path:

oak% which openwin
/usr/openwin
oak%

If you cannot find a command, look at the manual page. For example, if you cannot find the lpsched command (the LP printer daemon), the lpsched(1M) manual page tells you the path is /usr/lib/lp/lpsched.

Executing a Command

To execute a command, type command-name and press Return. The command is executed if it is in the search path. You can always execute a command that is not in the search path by typing the full path name for the command.

Recognizing Problems with Permissions and Ownership

When users cannot access files or directories that they used to be able to access, the most likely problem is that permissions or ownership on the files or directories has changed.

Frequently, file and directory ownerships change because someone edited the files as root. When you create home directories for new users, be especially careful to make the user the owner of the dot (.) file in the home directory. When users do not own the dot (.) files, they cannot create files in their own home directory.

Another way access problems can arise is when the group ownership changes or when a group that a user is a member of is deleted from the /etc /groups database.


Previous Table of Contents Next