Example: After installing Datastax Cassandra, when we try to login as cassandra user as 'su cassandra' we get above error.
How to resolve?
Run below commands as root user or user with sudo permission.
1) Verify if the user was created.
cat /etc/passwd | grep cassandra
(or)
getent passwd cassandra (get entries from Name Service Switch libraries)
output: cassandra:x:112:116:Cassandra database,,,:/var/lib/cassandra:/usr/sbin/nologin
Here, Note the /usr/sbin/nologin
It's not pointed to any shell to execute. So change it to point to any shell.
2) Use usermod to change the shell.
usermod -s /bin/bash cassandra
3) Verify the contents again.
cat /etc/passwd | grep cassandra
cassandra:x:112:116:Cassandra database,,,:/var/lib/cassandra:/bin/bash
4) Switch to cassandra user.
su cassandra
***