0

I've given an Ubuntu 18.04 box with user account which have root permission but not use /bin/bash as default shell. Hence, when I ssh to it, when I hit left, right, up, down ←↑→ keys, it will produces ^[[D ^[[A ^[[C

I want to change the user to default use /bin/bash shell with

sudo chsh -s /bin/bash {MY_USERNAME} 

but the terminal says:

chsh: /etc/passwd.20598: Permission denied 
chsh: cannot lock /etc/passwd; try again later

How could I fix it?

Luke
  • 475
  • 1
  • 6
  • 16
  • 2
    You can't, probably. Contact the administrator and ask them to change the shell, or start bash manually with `/bin/bash` – vidarlo Aug 25 '21 at 16:52
  • 1
    Try again later ... as suggested. Eventually you can run `lsof /etc/passwd` to see which process(es) that have /etc/passwd open - if any. – Soren A Aug 25 '21 at 16:58
  • @vidarlo : I have sudo permission on the server, what can I do with it? I've contact my IT admin and he only said that "I don't know" – Luke Aug 28 '21 at 12:40
  • I've update the question to make it clear, I have root permission, hence I can do almost anything with sudo, but cannot change the default shell :'( – Luke Aug 28 '21 at 12:41
  • 2
    You can change the default shell by editing the file `/etc/passwd`. But since the file is locked, it means that someone is editing it. (Or someone has started an editor and have that file open but probably forgot about it.) There's nothing you can do... Well...you could use `lsof` as suggested above and terminate the process that's editing it...but you really, really shouldn't do that. A "fight" between system administrators is the last thing any system needs. Try to find out who has it locked and *talk* to that person... `lsof` should tell you what program and the user that has it open – Ray Aug 28 '21 at 13:09

0 Answers0