1 |
On Wed, Jul 4, 2018 at 5:39 PM gevisz <gevisz@×××××.com> wrote: |
2 |
> 2018-07-03 16:22 GMT+03:00 Mart Raudsepp <leio@g.o>: |
3 |
|
4 |
|
5 |
>> If you use su, you should be using "su -" (or "su -l" or "su --login"), |
6 |
>> not "su". |
7 |
> |
8 |
> I have used only "su" for already 3 years, since switched to Gentoo |
9 |
> from Ubuntu and never had any problems with it. |
10 |
> |
11 |
> Could you explain a little bit more why "su -" should be used instead. |
12 |
> |
13 |
> From the man page I've got the following: |
14 |
> |
15 |
> -, -l, --login |
16 |
> Provide an environment similar to what the user would expect had |
17 |
> the user logged in directly. |
18 |
> |
19 |
> But I cannot see why I need the original root environment, |
20 |
> especially if I never set it up. |
21 |
|
22 |
It's more to protect from user envvars leaking into root's |
23 |
environment. That's why "service(8)" resets the environment (and then |
24 |
sets some, like PATH) on Linux and {Free,Net}BSD. |
25 |
|
26 |
I've seen a daemon log in german because a colleague simply used "su" |
27 |
to restart it (without using "service"). |
28 |
|
29 |
|
30 |
>> If you use sudo, you might need to pass -i (--login) option to it. |
31 |
> |
32 |
> I hate using sudo since I have been forced to use it in Ubuntu. |
33 |
|
34 |
Ubuntu defaults to "sudo" but doesn't force you to use it! If you |
35 |
prefer "su", set a root password. |