On Wed, Jul 4, 2018 at 5:39 PM gevisz <gev...@gmail.com> wrote:
> 2018-07-03 16:22 GMT+03:00 Mart Raudsepp <l...@gentoo.org>:


>> If you use su, you should be using "su -" (or "su -l" or "su --login"),
>> not "su".
>
> I have used only "su" for already 3 years, since switched to Gentoo
> from Ubuntu and never had any problems with it.
>
> Could you explain a little bit more why "su -" should be used instead.
>
> From the man page I've got the following:
>
> -, -l, --login
>     Provide an environment similar to what the user would expect had
>     the user logged in directly.
>
> But I cannot see why I need the original root environment,
> especially if I never set it up.

It's more to protect from user envvars leaking into root's
environment. That's why "service(8)" resets the environment (and then
sets some, like PATH) on Linux and {Free,Net}BSD.

I've seen a daemon log in german because a colleague simply used "su"
to restart it (without using "service").


>> If you use sudo, you might need to pass -i (--login) option to it.
>
> I hate using sudo since I have been forced to use it in Ubuntu.

Ubuntu defaults to "sudo" but doesn't force you to use it! If you
prefer "su", set a root password.

Reply via email to