Fwd: Another reason to prefer a real root over sudo
On Mon, Feb 2, 2009 at 9:10 AM, Pierre Frenkiel
<pierre.frenkiel@laposte.net> wrote:
> On Mon, 2 Feb 2009, Robert Parker wrote:
>> You can 'sudo su -'
>
> then, X11 doesn't work
You should be able to use 'su -p username'. I'm at work and can't test
it right now though.
>
> --
> Pierre Frenkiel
>
> --
> ubuntu-users mailing list
> ubuntu-users@lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
-- Jeff
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
02-05-2009, 07:35 AM
Pierre Frenkiel
Fwd: Another reason to prefer a real root over sudo
On Mon, 2 Feb 2009, Jeff Henson wrote:
> You should be able to use 'su -p username'. I'm at work and can't test
> it right now though.
thanks, it works ... but it just preserves the environment.
and curiously, "su - -p user" executes your .profile,
and not the user's one. A bug ?
So, if you need to execute the login scripts "sux - user" is better.
(it even executes them twice!)
--
Pierre Frenkiel
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
02-05-2009, 01:47 PM
Rashkae
Fwd: Another reason to prefer a real root over sudo
Pierre Frenkiel wrote:
> On Mon, 2 Feb 2009, Jeff Henson wrote:
>
>> You should be able to use 'su -p username'. I'm at work and can't test
>> it right now though.
>
> thanks, it works ... but it just preserves the environment.
> and curiously, "su - -p user" executes your .profile,
> and not the user's one. A bug ?
No, not a bug, but exactly what you asked for with that combination of
options. As you say, if you need to execute the login scripts *and*
maintain X, sux is better. (otherwise, you need to copy the .Xauthority
file from the old user's home direcoory to your own manually, which will
probably be impossible if you are su'ing to a user account rather than root.
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
02-06-2009, 12:18 PM
Pierre Frenkiel
Fwd: Another reason to prefer a real root over sudo
On Thu, 5 Feb 2009, Rashkae wrote:
> No, not a bug, but exactly what you asked for with that combination of
> options.
no. cf "man su"
================================================== ============
-, -l, --login
Provide an environment similar to what the user would expect had the user logged in
directly.
-m, -p, --preserve-environment
Preserve the current environment.
================================================== ============
so, the 2 options seem contradictory, but actually, -p doesn't preserve variables
that are set by any login script (.profile, ...)
--
Pierre Frenkiel
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
02-06-2009, 01:32 PM
Rashkae
Fwd: Another reason to prefer a real root over sudo
Pierre Frenkiel wrote:
> On Thu, 5 Feb 2009, Rashkae wrote:
>
>> No, not a bug, but exactly what you asked for with that combination of
>> options.
>
> no. cf "man su"
> ================================================== ============
> -, -l, --login
> Provide an environment similar to what the user would expect had the user logged in
> directly.
>
> -m, -p, --preserve-environment
> Preserve the current environment.
> ================================================== ============
>
>
> so, the 2 options seem contradictory, but actually, -p doesn't preserve variables
> that are set by any login script (.profile, ...)
>
No, but -p preservers $HOME, and your login scripts, as per the bash
man page, are:
~/.bash_profile, ~/.bash_login, or ~/.profile.
~, by the way, is a shortcut for $HOME
You see the problem now?
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
02-06-2009, 02:21 PM
Pierre Frenkiel
Fwd: Another reason to prefer a real root over sudo
On Fri, 6 Feb 2009, Rashkae wrote:
> No, but -p preserves $HOME
Right, as USER and HOME are generally not redefined in system wide login scripts.
If you add in /etc/profile
USER=`whoami`
eval HOME=~$USER
you get the good login scripts.
--
Pierre Frenkiel
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users