Linux: Can’t log in but password correct!

Last updated on | one reply

I was having an issue logging into shell with one of my users.

Checking the tail of the auth log:

sudo tail /var/log/auth.log -n 200

We have an error:

sshd[9961]: User myusername not allowed because shell /sbin/nologin does not exist
sshd[9961]: input_userauth_request: invalid user myusername [preauth]

It seems shell access was disabled for this user previously.

We can try setting the shell path back to /bin/bash – this is the default for Ubuntu.

sudo usermod -s /bin/bash myusername

Now try logging in again.

You can see a list of users and their shell paths in /etc/passwd

sudo less /etc/passwd

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

p.s. I increased my AdSense revenue by 200% using AI 🤖. Read my Ezoic review to find out how.

1 reply

Leave a reply

Your email address will not be published.

  1. THANK YOU THANK YOU THANK YOU!!! This has been driving me f****** crazy all morning!!

    This fixed my issue on OpenVPN AS