<chapter id="tsfileaccess-28392"><title>Troubleshooting
File Access Problems (Tasks)</title><highlights><para>This chapter provides information on resolving file access problems
such as those related to incorrect permissions and search paths.</para><itemizedlist><para>This is a list of troubleshooting topics in this chapter. </para><listitem><para><olink targetptr="tsfileaccess-95658" remap="internal">Solving Problems With
Search Paths (Command not found)</olink></para>
</listitem><listitem><para><olink targetptr="tsfileaccess-12987" remap="internal">Solving File Access
Problems</olink></para>
</listitem><listitem><para><olink targetptr="tsfileaccess-43006" remap="internal">Recognizing Problems
With Network Access</olink></para>
</listitem>
</itemizedlist><para>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. </para><itemizedlist><para>Whenever you encounter such a problem, investigate one of three areas:</para><listitem><para>The user's search path may have been changed, or the directories
in the search path may not be in the proper order.</para>
</listitem><listitem><para>The file or directory may not have the proper permissions
or ownership.</para>
</listitem><listitem><para>The configuration of a system accessed over the network may
have changed.</para>
</listitem>
</itemizedlist><para>This chapter briefly describes how to recognize problems in each of
these three areas and suggests possible solutions.</para>
</highlights><sect1 id="tsfileaccess-95658"><title>Solving Problems With Search Paths (<literal>Command not found</literal>)</title><itemizedlist><para>A message of <literal>Command not found</literal> indicates
one of the following: </para><listitem><para>The command is not available on the system.</para>
</listitem><listitem><para>The command directory is not in the search path.</para>
</listitem>
</itemizedlist><para>To fix a search path problem, you need to know the pathname of the directory
where the command is stored.</para><para>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.</para><para>You can display your current search path by using the <command>echo
$PATH</command> command. For example:</para><screen>$ <userinput>echo $PATH</userinput> 
/home/kryten/bin:/sbin:/usr/sbin:/usr/bin:/usr/dt:/usr/dist/exe</screen><para>Use the <command>which</command> command to determine whether you are
running the wrong version of the command. For example:</para><screen>$ <userinput>which acroread</userinput> 
/usr/doctools/bin/acroread</screen><note><para>The <command>which</command> command looks in the <filename>.cshrc</filename> file
for path information. The <command>which</command> command might give misleading
results if you execute it from the Bourne or Korn shell and you have a <filename>.cshrc</filename> file than contains aliases for the <command>which</command> command.
To ensure accurate results, use the <command>which</command> command in a
C shell, or, in the Korn shell, use the <command>whence</command> command.</para>
</note><task id="tsfileaccess-1"><title>How to Diagnose and Correct Search Path Problems</title><procedure><step id="tsfileaccess-step-3"><para>Display the current search path to verify
that the directory for the command is not in your path or that it isn't misspelled.</para><screen>$ <userinput>echo $PATH</userinput> </screen>
</step><step id="tsfileaccess-step-4"><para>Check the following:</para><itemizedlist><listitem><para>Is the search path correct?</para>
</listitem><listitem><para>Is the search path listed before other search
paths where another version of the command is found?  </para>
</listitem><listitem><para>Is the command in one of the search paths?</para>
</listitem>
</itemizedlist><para>If the path needs correction, go to step 3. Otherwise, go to step 4.</para>
</step><step id="tsfileaccess-step-5"><para>Add the path to the appropriate file,
as shown in this table.</para><informaltable frame="topbot"><tgroup cols="4" colsep="0" rowsep="1"><colspec colname="column1" colwidth="42.26*"/><colspec colname="column2" colwidth="80.80*"/><colspec colname="column3" colwidth="172.11*"/><colspec colname="column4" colwidth="62.83*"/><thead><row><entry><para>Shell</para>
</entry><entry><para>File</para>
</entry><entry><para>Syntax</para>
</entry><entry><para>Notes</para>
</entry>
</row>
</thead><tbody><row rowsep="0"><entry><para>Bourne and Korn</para>
</entry><entry><para><filename>$HOME/.profile</filename></para>
</entry><entry><para><literal>$</literal> <command>PATH=</command><replaceable>$HOME/bin:/sbin:/usr/local
/bin ...</replaceable></para><para><literal>$</literal> <command>export PATH</command></para>
</entry><entry><para>A colon separates path names.</para>
</entry>
</row><row><entry><para>C</para>
</entry><entry><para><filename>$HOME/.cshrc</filename></para><para>or</para><para><filename>$HOME/.login</filename></para>
</entry><entry><para><replaceable>hostname%</replaceable> <command>set path=(</command><replaceable>~bin /sbin  /usr/local/bin ...)</replaceable></para>
</entry><entry><para>A blank space separates path names.</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</step><step id="tsfileaccess-step-6"><para>Activate the new path as follows:</para><informaltable frame="topbot"><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="column1" colwidth="71*"/><colspec colname="column2" colwidth="90*"/><colspec colname="column3" colwidth="198*"/><thead><row rowsep="1"><entry><para>Shell</para>
</entry><entry><para>File Where Path Is Located</para>
</entry><entry><para>Use this Command to Activate The Path</para>
</entry>
</row>
</thead><tbody><row><entry><para>Bourne and Korn</para>
</entry><entry><para><filename>.profile</filename></para>
</entry><entry><para><literal>$</literal> <userinput>. ./.profile</userinput></para>
</entry>
</row><row><entry><para>C</para>
</entry><entry><para><filename>.cshrc</filename></para>
</entry><entry><para><replaceable>hostname%</replaceable> <userinput>source .cshrc</userinput></para>
</entry>
</row><row><entry><para></para>
</entry><entry><para><filename>.login</filename></para>
</entry><entry><para><replaceable>hostname</replaceable>% <userinput>source .login</userinput></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</step><step id="tsfileaccess-step-25"><para>Verify the new path.</para><screen>$ <userinput>which</userinput> <replaceable>command</replaceable></screen>
</step>
</procedure><example id="emjea"><title>Diagnosing and Correcting Search Path Problems</title><para>This example shows that the <command>mytool</command> executable is
not in any of the directories in the search path using the <command>which</command> command.</para><screen>venus% <userinput>mytool</userinput>
mytool: Command not found
venus% <userinput>which mytool</userinput>
no mytool in /sbin /usr/sbin /usr/bin /etc /home/ignatz/bin  .
venus% <userinput>echo $PATH</userinput>
/sbin /usr/sbin /usr/bin /etc /home/ignatz/bin
venus% <userinput>vi ~/.cshrc</userinput>
(<emphasis>Add appropriate command directory to the search path</emphasis>)
venus% <userinput>source .cshrc</userinput>
venus% <userinput>mytool</userinput></screen><para>If you cannot find a command, look at the man page for its directory
path. For example, if you cannot find the <command>lpsched</command> command
(the <literal>lp</literal> printer daemon), the <olink targetdoc="refman" targetptr="lpsched-1m" remap="external"><citerefentry><refentrytitle>lpsched</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page tells you the path
is <filename>/usr/lib/lp/lpsched</filename>.</para>
</example>
</task>
</sect1><sect1 id="tsfileaccess-12987"><title>Solving File Access Problems</title><para>When users cannot access files or directories that they previously could
access, the permissions or ownership of the files or directories probably
has changed.</para><sect2 id="tsfileaccess-33"><title>Changing File and Group Ownerships</title><para>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 (<literal>.</literal>) file in the home directory. When users
do not own &ldquo;<literal>.</literal>&rdquo; they cannot create files in
their own home directory. </para><para>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 <filename>/etc/group</filename> database.</para><para>For information about how to change the permissions or ownership of
a file that you are having problems accessing, see <olink targetdoc="sysadv6" targetptr="secfile-1" remap="external">Chapter 7, <citetitle remap="chapter">Controlling Access to Files (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Security Services</citetitle></olink>.</para>
</sect2>
</sect1><sect1 id="tsfileaccess-43006"><title>Recognizing Problems With Network Access</title><para>If users have problems using the <command>rcp</command> 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.</para><para>See <olink targetdoc="sysadv4" targetptr="rfsadmin-214" remap="external"><citetitle remap="section">Strategies for NFS Troubleshooting</citetitle> in <citetitle remap="book">System Administration Guide: Network Services</citetitle></olink> for
information about problems with network access and problems with accessing
systems through AutoFS.</para>
</sect1>
</chapter>