I have the following line in /etc/environment
:
AAABBB=cccddd
When I login using the text console, the variable is set, I don't even need to reboot. But if I do su -
, the variable is cleared. Why is that?
I have this on ArchLinux and on CentOS 6 and 7.
here grawity says:
Logging out and back in would apply the changes
But issuing the su
command with dash is that very thing!
I'm really unhappy that su -
clears the variable. Is there a way to make su behave better? One workaround is to duplicate the record in /etc/profile.d
. It's not enough to have the record in profile and not /etc/environment
, because there are cases when profile scripts aren't sourced, e.g. scp
.
Upd
[root@reallin ~]# cat /etc/pam.d/su
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
#auth required pam_wheel.so use_uid
auth required pam_unix.so
account required pam_unix.so
session required pam_unix.so
[root@reallin ~]# cat /etc/pam.d/su-l
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
#auth required pam_wheel.so use_uid
auth required pam_unix.so
account required pam_unix.so
session required pam_unix.so
su -
with-m
or-p
flags?root
user (which is whom you're logging in as withsu -
)? Is the variable set whenroot
ordinarily logs in?/bin/bash
; 2) yes/etc/security/pam_env.conf
file in your system? If yes, try to set the variable in that file and see if it works. Format is likeName DEFAULT=value