<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE>PATH HOWTO: Some strategies to get the same path for all the users</TITLE> <LINK HREF="Path-15.html" REL=next> <LINK HREF="Path-13.html" REL=previous> <LINK HREF="Path.html#toc14" REL=contents> </HEAD> <BODY> <A HREF="Path-15.html">Next</A> <A HREF="Path-13.html">Previous</A> <A HREF="Path.html#toc14">Contents</A> <HR> <H2><A NAME="s14">14. Some strategies to get the same path for all the users</A></H2> <P> <P>The most important settings is possible to set in the global shell initialization files for login shells: /etc/csh.login for tcsh and /etc/profile for bash. <P>Exceptions that do not get the right path from these files are rsh commands, ssh commands, menu items from X window manager that do not explicitly start login shell, commands invoked from inittab, cron jobs, daemons jobs like magic filters started from lprd, WWW CGI scripts, and so on. <P>If the path is set in /etc/csh.cshrc, the path is right even when rsh or ssh execute command in remote machine with account using tcsh/csh. However, it is not possible to set path if account uses bash/sh. <P>It is possible to combine path setting to one file, for example to a file /etc/environment-common. There we write: <P> <BLOCKQUOTE><CODE> <PRE> ${EXPORT}PATH${EQ}/bin:/usr/bin:/sbin:/usr/sbin:/usr/bin/X11:/usr/local/bin:/usr/games:. </PRE> </CODE></BLOCKQUOTE> <P>This can be used from /etc/csh.login (for tcsh and csh) <P> <BLOCKQUOTE><CODE> <PRE> set EQ=" " set EXPORT="setenv " source /etc/environment-common </PRE> </CODE></BLOCKQUOTE> <P>And from /etc/profile (for bash, doesn't work for ordinary sh) <P> <BLOCKQUOTE><CODE> <PRE> EQ='=' EXPORT="export " . /etc/environment-common </PRE> </CODE></BLOCKQUOTE> <P>And from /etc/environment (for XDM) <P> <BLOCKQUOTE><CODE> <PRE> EQ="=" EXPORT="export " . /etc/environment-common </PRE> </CODE></BLOCKQUOTE> <P>This strategy works mostly but ssh will complain of the lines in /etc/environment (and defined environment variables EQ and EXPORT). And still, rsh commands executed with bash won't get this path. <P> <P> <HR> <A HREF="Path-15.html">Next</A> <A HREF="Path-13.html">Previous</A> <A HREF="Path.html#toc14">Contents</A> </BODY> </HTML>