74 lines
2.0 KiB
HTML
74 lines
2.0 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
|
<TITLE>PATH HOWTO: Changing user ID</TITLE>
|
|
<LINK HREF="Path-8.html" REL=next>
|
|
<LINK HREF="Path-6.html" REL=previous>
|
|
<LINK HREF="Path.html#toc7" REL=contents>
|
|
</HEAD>
|
|
<BODY>
|
|
<A HREF="Path-8.html">Next</A>
|
|
<A HREF="Path-6.html">Previous</A>
|
|
<A HREF="Path.html#toc7">Contents</A>
|
|
<HR>
|
|
<H2><A NAME="s7">7. Changing user ID</A></H2>
|
|
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="ss7.1">7.1 su</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>Command su sets a new user id to use. If no user id is given, root is
|
|
used.
|
|
<P>Normally su invokes a subshell with a different user id. With
|
|
argument '-' (more recent synonyms -l or --login) su invokes shell
|
|
like login shell. However, it does not use login program to do this
|
|
but uses a yet another built-in path for login 'simulation' (term used
|
|
in the source code). It is:
|
|
<P>for normal users
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:.
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
|
|
for root user
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
/sbin:/bin:/usr/sbin:/usr/bin:/usr/bin/X11:/usr/local/sbin:/usr/local/bin
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>su makes many quite subtle environment changes as well.
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="ss7.2">7.2 sudo</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>There is a group of commands that make use of super user commands
|
|
safer. They allow better logging, user-based restrictions and usage
|
|
of individual passwords. Most widely used is sudo.
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ sudo env
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>executes command env as super user (if it is configured to allow it).
|
|
<P>sudo command has again a different approach to path handling. It
|
|
modifies the search path so that the current directory is always the
|
|
last one. However, it does not modify PATH environment variable.
|
|
'sudo env' and 'env' give the same value for PATH variable. Sudo adds
|
|
just couple of environment variables like SUDO_USER.
|
|
<P>
|
|
<P>
|
|
<HR>
|
|
<A HREF="Path-8.html">Next</A>
|
|
<A HREF="Path-6.html">Previous</A>
|
|
<A HREF="Path.html#toc7">Contents</A>
|
|
</BODY>
|
|
</HTML>
|