[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: XDG_... env variables in root
From: |
Hamzeh Nasajpour |
Subject: |
Re: XDG_... env variables in root |
Date: |
Thu, 08 Jul 2021 11:15:16 +0430 |
User-agent: |
Cyrus-JMAP/3.5.0-alpha0-531-g1160beca77-fm-20210705.001-g1160beca |
Hi,
https://unix.stackexchange.com/questions/7013/why-do-we-use-su-and-not-just-su/7021#7021
>su - invokes a login shell after switching the user. A login shell resets most
>environment variables, providing a clean base.
>su just switches the user, providing a normal shell with an environment nearly
>the same as with the old user.
Seems that this is relevant to way of switching user which I used. I was using
`su` for switching as `root` and just now I found that there are some
differences between `su` and `su -`. With using of `su -` the `XDG_...` env
paths are correct:
```
$ su -
$ printenv | grep XDG_
XDG_CONFIG_DIRS=/run/current-system/profile/etc/xdg:/root/.guix-profile/etc/xdg:/run/current-system/profile/etc/xdg
XDG_DATA_DIRS=/run/current-system/profile/share:/root/.guix-profile/share:/run/current-system/profile/share
```
Anyway I didn't know there are differences between `su` and `su -`.
Regards,
Hamzeh