As the question above states, I have a RHEL 6 server that is designed for SSH access, with root unable to login through SSH by design. When I am at the server locally I can login as root, but only as root.
If I try to log in as a user the screen quickly flashes a message reading:
Last Login: Mon Aug 24 08:24:52 on tty1
no directory: /home/user1!
logging in with home="/"
login: no shell: Permission denied
I am getting the no shell because there is no shell in /
.
Now what is really confusing to me though is that the home directory does indeed exist, and contains a valid shell, and is permissioned right from what I can tell (755
). This is common for all users that existed and have been created on this server instance. It seems to matter not if I define a path to the home directory when I make a user or let the default take charge and assign it automatically.
I have not found anything strange in the Secure log or messages log, only that the user successfully logged in (which they have, but can't do anything without a shell)
I am hoping to not need to reinstall at this point, but there is almost no data on the server that would be lost if that is the only option.
Any help would be very much appreciated as I have searched and tried for a week now with no luck.
Edit:
I used the useradd user1
command to originally add the user, when that resulted in the problems above I used
mkdir /home/user1 && useradd user1 -d /home/user1 && chown -R user:user1 /home/user
When I run the cat /etc/passwd | grep user1
command I get:
user1:x:513:517::/home/user1:bin/bash
and when I run the ls -l /home
command the entry for that user is:
drwxr-xr-x. 4 user1 user1 4096 Aug 19 17:03 user1
Best Answer
I was able to fix the problem by running the command
and restarting the server. Once it restarted not only was I able to log in as any user that had been created I was able to again use the GUI as well. This points to corrupted file permissions somewhere on the system. How they became corrupted I do not know, but it all now works.