On Friday 2013-03-22 18:06, Linda Walsh wrote:
Ken Schneider - openSUSE wrote:
Right -- if I sudo bash -i , I don't have the problem -- everything is preserved.
But either sudo su -p OR su -p Both reset parts (if not all of) my 'env'
If you want to maintain your login env just plain su will do that. I vert highly recommend you DON'T. You will mess up your login.
How does it mess up your login? I don't like using su (also, my 'su' is aliased to 'su -p') by itself -- as I have to type in the password. Thus, I usually use sudo, which used to require a command, so sudo su, was the shortest way to a root prompt while maintaining my environment.
Now, sudo has an option that can shortcut that, but old habits have me typing in sudo su about 70% of the time
And it's kind of dumb. sudo already gives you the root surroundings, so sudo bash would be sufficient. But note that sudo resets the environment by default, which is why 11:48 nakamura:~ > sudo xterm Warning: This program is an suid-root program or is being run by the root user. The full text of the error or warning message cannot be safely formatted in this environment. You may get a more descriptive message by running the program as a non-root user or by removing the suid bit on the executable. xterm: Xt error: Can't open display: %s xterm: DISPLAY is not set 11:48 nakamura:~ > su - -c xterm Passord: <xterm pops up> There is sudo -E, but that still screws around: 11:51 nakamura:~ > sudo -E xterm Warning: Tried to connect to session manager, Authentication Rejected, reason : None of the authentication protocols specified are supported and host-based authentication failed <xterm pops up>
, But that's resetting key variables (majority are NOT changed)...
LS_OPTIONS & PATH
PS1 REMOTEHOST DISPLAY
The ones that cause things to break: PS1, REMOTEHOST, DISPLAY
LS_OPTIONS and PATH changes don't seem to be a problem
LS_OPTIONS, PATH and PS1 are set from /etc/bashrc* and/or /etc/profile*, so that is not directly a su/sudo problem - depending on su options, it either starts a shell, or a login shell, and the login shell definitely reexecutes the profile things. SYNOPSIS su [OPTION]... [-] [USER [ARG]...] DESCRIPTION Change the effective user id and group id to that of USER. -, -l, --login make the shell a login shell -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org