0

My problem: I cannot set my default shell for user 'student' on CentOS 7 to fish-shell. I installed fish-shell by downloading the .gz, configuring, make, make install.

output of which fish
/usr/local/bin/fish

running su from the standard 'student' account, I am able to escalate myself to root, which fish is set as the default shell. But when I run

student@localhost ~> whoami
root
student@localhost ~>
/root
student@localhost ~> sudo chsh -s /usr/local/bin/fish student
Changing shell for student. 
chsh: user attribute not changed: Invalid contents of lock `/etc/passwd.lock`

looking at /etc/passwd I can see no changes occured.

Any idea what I can do? It looks like the lock files are preventing me from proceeding.

  • (1) Why does whoami report root when you are logged in as student?  (2) Why does your shell report /root when you type Enter?  (3) Does /etc/passwd.lock exist after you run chsh?  (4) What’s in it?  (5) What happens when you run chsh -s /usr/local/bin/fish (without su or sudo)? – Scott Feb 13 '16 at 7:38
2

Looks like one of your previous attempts to change the /etc/passwd file has left some rubbish in the lock file.

That lock file prevents multiple updates that would cancel each other out. If you are the only one using that system, remove the file /etc/passwd.lock and try again.

  • its weird, this sorta fixed the issue. I deleted passwd.lock and shadow.lock and then ran sudo chsh -s /user/local/bin/fish student and i get "chsh: Shell not changed" .. thats it. – Oscalation Feb 13 '16 at 6:27
  • /etc/passwd is showing the shell listed as fish, restarting the machine to check if changes took – Oscalation Feb 13 '16 at 6:28
  • problem solved, than you Anthon – Oscalation Feb 13 '16 at 6:30
  • @Oscalation You do not need to reboot everytime you change passwd. At most, if changing a logged user, you need to login and logout. – Rui F Ribeiro Feb 13 '16 at 7:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.