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

**URL:** <https://boards.straightdope.com/t/linux-cant-log-in-except-as-root-permissions-issue-need-help-fast/611979>\
**Category:** Factual Questions\
**Created:** [February 6, 2012, 2:34pm UTC](https://boards.straightdope.com/t/linux-cant-log-in-except-as-root-permissions-issue-need-help-fast/611979 "2012-02-06T14:34:23Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dr.Love](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Dr.Love](https://boards.straightdope.com/u/Dr.Love)\
**Post date:** [February 6, 2012, 2:34pm UTC](https://boards.straightdope.com/t/linux-cant-log-in-except-as-root-permissions-issue-need-help-fast/611979/1 "2012-02-06T14:34:23Z")

</div>

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:

```auto

# 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/

```

```auto

# 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/

```

```auto

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

```

```auto

# 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?

---

<div class="post-metadata">

**Author:** ![Simplicio](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@Simplicio](https://boards.straightdope.com/u/Simplicio)\
**Post date:** [February 6, 2012, 3:06pm UTC](https://boards.straightdope.com/t/linux-cant-log-in-except-as-root-permissions-issue-need-help-fast/611979/2 "2012-02-06T15:06:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Simplicio](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@Simplicio](https://boards.straightdope.com/u/Simplicio)\
**Post date:** [February 6, 2012, 3:09pm UTC](https://boards.straightdope.com/t/linux-cant-log-in-except-as-root-permissions-issue-need-help-fast/611979/3 "2012-02-06T15:09:57Z")

</div>

Alternatively, if you have SElinux, that apparently has caused the same error message [for some users](http://www.linuxquestions.org/questions/linux-security-4/su-bin-bash-permission-denied-458043/)

---

<div class="post-metadata">

**Author:** ![Fubaya](https://avatars.discourse-cdn.com/v4/letter/f/c2a13f/32.png) [@Fubaya](https://boards.straightdope.com/u/Fubaya)\
**Post date:** [February 6, 2012, 4:49pm UTC](https://boards.straightdope.com/t/linux-cant-log-in-except-as-root-permissions-issue-need-help-fast/611979/4 "2012-02-06T16:49:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![blindboyard](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/blindboyard/32/2833_2.png) [@blindboyard](https://boards.straightdope.com/u/blindboyard)\
**Post date:** [February 6, 2012, 7:01pm UTC](https://boards.straightdope.com/t/linux-cant-log-in-except-as-root-permissions-issue-need-help-fast/611979/5 "2012-02-06T19:01:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Dr.Love](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Dr.Love](https://boards.straightdope.com/u/Dr.Love)\
**Post date:** [February 6, 2012, 8:29pm UTC](https://boards.straightdope.com/t/linux-cant-log-in-except-as-root-permissions-issue-need-help-fast/611979/6 "2012-02-06T20:29:48Z")

</div>

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

```auto

# 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](http://www.linux-migration.org/ch02s03.html), but as far as I can tell all these files should be working correctly:

```auto

# 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.

---

<div class="post-metadata">

**Author:** ![Dr.Love](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Dr.Love](https://boards.straightdope.com/u/Dr.Love)\
**Post date:** [February 6, 2012, 8:34pm UTC](https://boards.straightdope.com/t/linux-cant-log-in-except-as-root-permissions-issue-need-help-fast/611979/7 "2012-02-06T20:34:57Z")

</div>

Perhaps this gives another clue:

```auto

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

```

---

<div class="post-metadata">

**Author:** ![MannyL](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@MannyL](https://boards.straightdope.com/u/MannyL)\
**Post date:** [February 7, 2012, 3:45am UTC](https://boards.straightdope.com/t/linux-cant-log-in-except-as-root-permissions-issue-need-help-fast/611979/8 "2012-02-07T03:45:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nanoda](https://avatars.discourse-cdn.com/v4/letter/n/ce73a5/32.png) [@Nanoda](https://boards.straightdope.com/u/Nanoda)\
**Post date:** [February 7, 2012, 4:31am UTC](https://boards.straightdope.com/t/linux-cant-log-in-except-as-root-permissions-issue-need-help-fast/611979/9 "2012-02-07T04:31:09Z")

</div>

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

```auto

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.

---

<div class="post-metadata">

**Author:** ![DarrenS](https://avatars.discourse-cdn.com/v4/letter/d/977dab/32.png) [@DarrenS](https://boards.straightdope.com/u/DarrenS)\
**Post date:** [February 7, 2012, 5:14am UTC](https://boards.straightdope.com/t/linux-cant-log-in-except-as-root-permissions-issue-need-help-fast/611979/10 "2012-02-07T05:14:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Dr.Love](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Dr.Love](https://boards.straightdope.com/u/Dr.Love)\
**Post date:** [February 7, 2012, 5:45am UTC](https://boards.straightdope.com/t/linux-cant-log-in-except-as-root-permissions-issue-need-help-fast/611979/11 "2012-02-07T05:45:08Z")

</div>

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.
