[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: "reloading" /etc/login.defs ENV_PATH without restarting



gautamc wrote:
> 1. I need a certain directory on my debian squeeze machine ( /var/lib/
> gems/1.8/bin/ ) to be in the PATH when i run a sudo command. Hence, I
> appended this dir to the ENV_PATH item in /etc/login.defs

Two comments:

First comment: If you need that for sudo then instead of changing
login.defs I think you should set the change in /etc/sudoers and add
that path to the secure_path variable.  Here is the default:

  Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

Add your path to that path and place it in the sudoers file and then
it will always be activated for each use of sudo.

Second comment: You might want to subscribe to debian-ruby and discuss
your ruby environment there.  It is really a tragedy that the upstream
Ruby community has taught everyone that you must use root to smash
installations over the top of systems.  It is a shame that Ruby
couldn't have learned from the trail blazed by Perl.  That is a very
long discussion however.

> 2. Is there is a way to get /etc/login.defs "re-evaluated" without
> rebooting.  I put an export PATH in ~/.profile and have the path set
> for the non-root user. However, a sudo command doesn't see the new dir
> in $PATH.

The /etc/login.defs and ~/.profile and /etc/profile all are sourced
when the user logs into the account.  Therefore in order to source
those again you either need to manually source the files (with "source
~/.profile or ". ~/.profile")), OR exec a new login shell on top of
the current shell (with "exec bash -l"), OR log out and log back in
again.  You do NOT need to reboot.

However none of those options are very appealing to me.  On a
Unix-like system such as Debian you should always be able to install
something and have it be immediately available.  It is a tragedy when
that paradigm is broken by misguided processes such as one my peeves
/etc/profile.d/ and others.  Setting up sudo's secure_path takes
immediate affect and does not require any manual sourcing or logging
out and back in.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: