NetBSD-Users archive

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

Re: Switching user and environment variables to root to install packages



"Rocky Hotas" <rockyhotas%post.com@localhost> writes:

> Hi everybody!
> In order to install new pagkages with pkgsrc it is necessary to set the 
> environment variables PATH and PKG_PATH.
> This can be done for root, which have the needed permissions to install new 
> packages.
> With a common user and the command su it can be still possible to have the 
> necessary permissions, but the variable PATH and PKG_PATH are not set.
> So, I would like to ask two question:
> - which is in such cases the best approach? To set PATH and PKG_PATH in 
> /etc/profile for all users or to mantain the actual configuration?
> - Is there a way to completely switch the user and its environment variables?
> Thanks!

See the man pages for su and sudo (a package).  In particular see -l and
-m to su, and -E to sudo.  What I do is set environment variables I want
in my own dotfiles, and then use "sudo -E" to get a root shell with my
variables.  There are lots of ways to do it, and it's really just a
matter of preference.

Attachment: pgpb1eOy_k3NG.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index