Linux: Can't log in except as root. Permissions issue? Need help fast!

I was trying to install the printer driver for my Samsung printer that I got from Samsung’s website some time ago. I first tried to install it from user account using sudo, but noticed that it changed ownership and permissions for /lib64, /etc and /usr (they were now owned by my user account drlove). I then tried to install it from the root account, and noticed that it changed the permissions for the same folders again (though it kept ownerships as root:root). I tried to change everything back, but I must have missed something because I can no longer log into my user account, nor run any commands from areas that are logged in already.

I can still log in as root. When I try “su drlove”, I get the error “su: /bin/bash: Permission denied”

I’ve installed the Samsung driver on two other Linux machines, one Arch and one Ubuntu, and never had problems like this before.

I’ve posted this on the Arch Linux forums, which hasn’t yet generated any responses. I’m hoping to get some ideas soon, otherwise I’m going to have to reinstall the operating system, which will take a while to get everything set up again.

Some information that might be helpful:


# ls -l /
total 69
drwxr-xr-x   2 root root  4096 Feb  1 12:52 bin/
drwxr-xr-x   4 root root  1024 Jan 27 20:27 boot/
drwxr-xr-x  16 root root  5300 Feb  4 08:11 dev/
drwxr-xr-x  76 root root  4096 Feb  5 21:34 etc/
drwxr-xr-x   4 root root  4096 Oct 25 03:54 home/
drwxr-xr-x  11 root root  4096 Feb  5 14:24 lib/
drwxr-xr-x   2 root root  4096 Jan 27 20:27 lib64/
drwx------   2 root root 16384 Oct 24 19:58 lost+found/
drwxr-xr-x   2 root root  4096 Jan 27 20:27 media/
drwxr-xr-x   2 root root  4096 Dec 19 10:44 mnt/
drwxr-xr-x   4 root root  4096 Feb  5 21:22 opt/
dr-xr-xr-x 160 root root     0 Feb  4 01:11 proc/
drwxr-x---   6 root root  4096 Feb  5 21:44 root/
drwxr-xr-x  18 root root   600 Feb  5 21:21 run/
drwxr-xr-x   2 root root  4096 Feb  1 12:52 sbin/
drwxr-xr-x   4 root root  4096 Dec 19 10:44 srv/
drwxr-xr-x  13 root root     0 Feb  4 01:11 sys/
drwxrwxrwt  16 root root   400 Feb  5 21:30 tmp/
drwxr-xr-x  10 root root  4096 Feb  5 21:30 usr/
drwxr-xr-x  12 root root  4096 Jan 27 20:27 var/


# ls -l home
total 20
drwx------ 39 drlove users  4096 Feb  5 20:02 drlove/
drwx------  2 root  root  16384 Oct 24 19:58 lost+found/


# ls -l /bin/bash
-rwxr-xr-x 1 root root 733896 Nov 22 23:46 /bin/bash*


# ls -l /etc/passwd
-rw-r--r-- 1 root root 613 Oct 25 20:46 /etc/passwd

Can anyone think of anything that I haven’t checked?

I think you changed the permissions on the su command. Type “which su” to find out where the command is (its in /bin on my system) and then post its permissions.

Alternatively, if you have SElinux, that apparently has caused the same error message for some users

Definitely check the su binary, but /home looks messed up. On my Slackware and Debian boxes the users /home directories are drwxr-xr-x. But you’re still owner so you should be able to change it, just use chmod -r or -R, I can never remember which.

It’s bash, not su, that’s giving you permission denied. Can’t see a reason, though. 700 permissions on ~/ wouldn’t do it, your permissions on passwd and /bin/bash seem alright.

I’m not running SELinux. I checked the permissions on su and got a normal result:


# ls -l /bin/su
-r-sr-xr-x 1 root root 41359 Jan  7 22:44 /bin/su*

If it was su causing the problem, then I would be able to log in from the prompt. As it is, I can only log in as root.

I’ve messed up the permissions on a home directory before. Usually Linux would let you log in, but throw an error about not having a valid home directory for the user.

I found the login sequence, but as far as I can tell all these files should be working correctly:


# ls -l /etc/shadow
-rw------- 1 root root 523 Feb  5 22:14 /etc/shadow
# ls -l /etc/group
-rw-r--r-- 1 root root 566 Oct 25 20:46 /etc/group

I’m completely lost as to what went wrong.

Perhaps this gives another clue:


# login -f drlove
Last login: Mon Feb  6 13:31:11 MST 2012 on tty1
Unable to cd to '/home/drlove'

if you do cd /home then ls is there a entry for drlove?

I don’t have the time to test, but try


ls -la

and verify the hidden files.
If your .bash_history or similar file got the ownership changed, I can imagine it would start throwing that error.

Sometimes strace can help, if you have it installed (if not, it’s in the repos for most distros).

Something like

strace -Ff -o st.txt su drlove

Then examine st.txt - often just before the error text - to see what it was trying to read and what error code it received.

A couple hours after my last post I decided to just reinstall the OS. In situations like this I’m very glad that I keep /home on its own partition. I didn’t change anything in /home, but it all works now.