0
Is there a config file that stores the default shell (bash, zsh, etc) for the current user ?
0
Is there a config file that stores the default shell (bash, zsh, etc) for the current user ?
5
The default shell used by a user is contained in the seventh field of /etc/passwd
or its equivalent.
$ getent passwd xxxxxx | awk -F: '{ print $7 }'
/bin/bash
Is there another way that doesn't require access to such file like passwd – faressoft – 2018-07-30T17:44:29.637
The only reliable place this information can be found is passwd
. – Ignacio Vazquez-Abrams – 2018-07-30T17:45:16.350
When I install zsh how doesn't mark itself as the login shell – faressoft – 2018-07-30T17:46:34.560
1Did you use chsh
to tell the system to use it? – Ignacio Vazquez-Abrams – 2018-07-30T17:47:08.440
Oh maybe it does that, that's why it asks me for permissions – faressoft – 2018-07-30T17:48:01.930
So chsh changes the passwd file – faressoft – 2018-07-30T17:48:18.407
1@faressoft: You can check that with strace
, for example strace chsh -s $(command -v bash) |& grep open
– Arkadiusz Drabczyk – 2018-07-30T18:31:15.160
@faressoft Please note you should always have access to /etc/passwd
. It is where you user ID and username are mapped, and your home directory, and default shell, and it has to be accessible by a lot of things. You are maybe thinking of /etc/shadow
(which is where passwords are stored) and that is usually not world-readable. – BenjiWiebe – 2018-07-30T19:24:44.120
@faressoft In fact, when you log in, the shell you get actually is read from your /etc/passwd
, via the same mechanism getent uses. – BenjiWiebe – 2018-07-30T19:26:01.627
Terminals don't have shells, users do. – Ignacio Vazquez-Abrams – 2018-07-30T17:41:59.460
@IgnacioVazquez-Abrams Thanks, edited – faressoft – 2018-07-30T17:43:31.170