Hello,
yesterday I've installed Debian 9.4 (with MATE desktop) from DVD's and created during the GUI mode installation process an user with bash as the login shell.
When I login as this user, neither '/etc/profile' (with files from '/etc/profile.d') nor '${HOME}/.profile' are read/executed! But it reads '/etc/bash.bashrc' and '${HOME}/.bashrc'.
When I login as root, all these files are read.
I have not made any changes to these system files so far.
Thanks in advance,
Michael
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
/etc/profile and ${HOME}/.profile not read for non root
- dilberts_left_nut
- Administrator
- Posts: 5346
- Joined: 2009-10-05 07:54
- Location: enzed
- Has thanked: 13 times
- Been thanked: 66 times
Re: /etc/profile and ${HOME}/.profile not read for non root
https://wiki.debian.org/EnvironmentVariables wrote:The login shell starts and reads its shell-specific configuration files.
bash first reads /etc/profile to get values that are defined for all users. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first of these files that exists and is readable. See DotFiles for full details.
AdrianTM wrote:There's no hacker in my grandma...
Re: /etc/profile and ${HOME}/.profile not read for non root
how exactly did you do that?MickPF wrote:created (...) user with bash as the login shell.
it sounds like you didn't just go with defaults, but made some conscious choices, but then bash is the default login shell anyhow, no?
highly unlikely.MickPF wrote:When I login as this user, neither '/etc/profile' (with files from '/etc/profile.d') nor '${HOME}/.profile' are read/executed!
how did you form that opinion?
Re: /etc/profile and ${HOME}/.profile not read for non root
Hello debiman,
during the installation process I was asked for user data to be created. This process creates this user with "bash" as the login shell.
It's very unlikely to find intelligent life on Earth also, you will find it definitely not everywhere but here and there.
I set and exported some different environment variables in '/etc/profile', in '/etc/profile.d/my_env.sh', in '${HOME}/.profile', in '/etc/bash.bashrc' and in '${HOME}/.bashrc'.
Asking for their values in a terminal window (SHELL=/bin/bash) displays only vars set in '/etc/bash.bashrc' and in '${HOME}/.bashrc'.
Values of vars set in '/etc/profile', in '/etc/profile.d/my_env.sh' and in '${HOME}/.profile' are empty.
during the installation process I was asked for user data to be created. This process creates this user with "bash" as the login shell.
It's very unlikely to find intelligent life on Earth also, you will find it definitely not everywhere but here and there.
I set and exported some different environment variables in '/etc/profile', in '/etc/profile.d/my_env.sh', in '${HOME}/.profile', in '/etc/bash.bashrc' and in '${HOME}/.bashrc'.
Asking for their values in a terminal window (SHELL=/bin/bash) displays only vars set in '/etc/bash.bashrc' and in '${HOME}/.bashrc'.
Values of vars set in '/etc/profile', in '/etc/profile.d/my_env.sh' and in '${HOME}/.profile' are empty.
Nobody is perfect.
My name is NOT Nobody.
My name is NOT Nobody.
Re: /etc/profile and ${HOME}/.profile not read for non root
quoted from https://wiki.debian.org/DotFiles :
of course you should read the whole article.Now, since bash is being invoked as a login shell (with name "-bash", a special ancient hack), it reads /etc/profile first. Then it looks in your home directory for .bash_profile, and if it finds it, it reads that. If it doesn't find .bash_profile, it looks for .bash_login, and if it doesn't find that, it looks for .profile (the standard Bourne/Korn shell configuration file). Otherwise, it stops looking for dot files, and gives you a prompt.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: /etc/profile and ${HOME}/.profile not read for non root
tl;dr: for a display manager login, add your lines to ~/.xsessionrc instead of ~/.profile.
deadbang