Содержащиеся в
Найти другие документы
Ресурсы поддержки
| Загрузить это руководство в формате PDF
Recognizing File Access Problems
38
- 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 used to be able to 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.
Solving Problems With Search Paths
- 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.
- 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.
· How to Diagnose and Correct Search Path Problems
-
-
Display the current search path.
-
-
-
Check the following:
-
- Is the search path correct?
- Is the search path listed before other search paths where another version of the command is found?
- Make sure the command is in one of the search paths.
- If the path needs correction, go to step 3. Otherwise, go to step 4.
-
-
Set the path as follows:
-
| Shell | File | Syntax | Notes |
| Bourne and Korn | $HOME/.profile | path=.:/usr/bin: | A colon separates path names. |
| C | $HOME/.cshrc or$ HOME/.login | set path | A blank space separates the two words. |
-
-
Activate the new path as follows:
-
| Shell | File Where Path Is Located | Command |
| Bourne and Korn | .profile. | . .profile |
| C | .cshrc | source .cshrc |
| .login | source .login |
Verification--Diagnosing and Correcting Search Path Problem
- To verify the path use the command shown in Table 38-1:
-
Table 38-1
| Shell | Command |
| Bourne and Korn | $ echo $PATH |
| C | hostname% echo $PATH |
Example--Diagnosing and Correcting Search Path Problems
-
$ command
command not found
$ echo $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.
-
Note - 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 you have a .cshrc file that contains aliases for which. To ensure accurate results, use the which command in a C shell, or, in the Korn shell, use the whence command.
- This example shows that the OpenWindows executable is not in any of the directories in the search path:
-
venus% which openwin
no openwin in . /home/ignatz /sbin /usr/sbin /usr/bin /etc \
/home/ignatz/bin /bin /home/bin /usr/etc
venus%
|
- This example shows that the executable for OpenWindows is found among the directories in the search path:
-
venus$ which openwin
/usr/openwin
venus$
|
- If you cannot find a command, look at the manual page. For example, if you cannot find the lpsched command (the lp printer daemon), lpsched(1M) tells you the path is /usr/lib/lp/lpsched.
Solving Problems With Permission 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 of 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 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/groups database.
· How to Change File Permissions
-
Table 38-2 shows the octal values for setting file permissions. You use these numbers in sets of three to set permissions for owner, group, and other. For example, the value 644 sets read/write permissions for owner, and read-only permissions for group and other.
-
Table 38-2
| Value | Description |
| 0 | No permissions |
| 1 | Execute-only |
| 2 | Write-only |
-
Table 38-2 (Continued)
| Value | Description |
| 3 | Write, execute |
| 4 | Read-only |
| 5 | Read, execute |
| 6 | Read, write |
| 7 | Read, write, execute |
-
-
List the file permissions.
-
- The long listing shows the current permissions for the file.
-
-
Change the file permissions.
-
- Permissions are changed using the numbers you specify.
-
Note - 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.
Example--Changing File Permissions
- This example shows changing the permissions of a file from 666 (read/write, read/write, read/write) to 644 (read/write, read-only, read-only).
-
$ ls -l quest
-rw-rw-rw- 1 ignatz staff 6023 Aug 5 12:06 quest
$ chmod 644 quest
|
Verification--Changing File Permissions
- To verify that the permissions have been changed, use the ls -l command.
-
$ ls -l
-rw-r--r-- 1 ignatz staff 6023 Aug 5 12:06 quest
$
|
· How to Change File Ownership
-
Note - You must own a file or directory (or have root permission) to be able to change its owner.
-
-
Become root.
-
List the file permissions.
-
- The owner of the file is displayed in the third column.
-
-
Change file owner.
-
# chown new-owner filename
|
- Ownership is assigned to the new owner you specify.
Example--Changing File Ownership
-
# ls -l quest
-rw-r--r-- 1 fred staff 6023 Aug 5 12:06 quest
# chown ignatz quest
|
Verification--Changing File Ownership
-
# ls -l quest
-rw-r--r-- 1 ignatz staff 6023 Aug 5 12:06 quest
#
|
· How to Change File Group Ownership
- Change a file's group ownership.
-
- The group ID for the file you specify is changed.
Example--Changing File Group Ownership
-
$ ls -lg junk
-rw-r--r-- 1 other 3138 Oct 31 14:49 junk
$ chgrp 10 junk
|
Verification--Changing File Group Ownership
-
$ ls -lg junk
-rw-r--r-- 1 staff 3138 Oct 31 14:49 junk
$
|
- See "Managing System Security" in System Administration Guide, Volume II for information about how to edit group accounts.
Recognizing Problems With Network Access
- 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.
|
|