Score:0

chsh: /etc/passwd.20598: Permission denied

ng flag

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?

vidarlo avatar
om flag
You can't, probably. Contact the administrator and ask them to change the shell, or start bash manually with `/bin/bash`
Soren A avatar
mx flag
Try again later ... as suggested. Eventually you can run `lsof /etc/passwd` to see which process(es) that have /etc/passwd open - if any.
ng flag
@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"
ng flag
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 :'(
cn flag
Ray
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
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.