Score:1

Root invalid default shell

fk flag

We have a server with ssh enabled, and we have: PermitRootLogin: no, and a user that is not in sudoers file. Another administator set invalid Shell for root so I can't get root access anymore. When I run su command and enter root password it says: su: failed to execute /bin/vash. I think the admin wanted to set bash as default Shell but here is a typo. How can I access root again?

Score:1
cg flag

From man su:

   -s, --shell=shell
          Run the specified shell instead of the default.

So try:

su root -s /bin/sh

Then run chsh to reset the shell to a valid default

Ivan avatar
fk flag
So I wasn't in sudoers file) But I've already fixed that
Ivan avatar
fk flag
Thanks anyway !
Score:0
fk flag

Oh guys I've fixed that))) Here is my solution:

cp /bin/bash ~/vash
export PATH = "$PATH:~"
alias "/bin/vash"="/home/USER/vash"
su
hr flag
I'm struggling to see how this can possibly work - how does an alias defined in the unprivileged shell have any effect on how `su` locates `/bin/vash`? and `export PATH = "$PATH:~"` is invalid (for more than one reason) in at least bash/dash/zsh/ksh. Can you check your command history please?
Ivan avatar
fk flag
@steeldriver Hello, My history matches my post. I understand your doubts because I also wonder how it works but it helped me to access root shell (there I ran chsh command and set bash as a default shell). Maybe I'll try to repeat this on a VM.
I sit in a Tesla and translated this thread with Ai:

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.