Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a brand new Scientific Linux 6 instance (Similar to RHEL6 & CentOS6), running on Parallels.

The home directory is in a non-standard location, which I'll call /homedir

When I ssh into this box I get an error:

laptop $ ssh
stefanl@'s password: 
Could not chdir to home directory /homedir/stefanl: Permission denied

But then immediately afterwards I can chdir to that directory, without an error:

[stefanl@localhost /]$ cd /homedir/stefanl
[stefanl@localhost ~]$ touch foo
[stefanl@localhost ~]$ ls -la
total 28
drwx------. 3 stefanl wheel   4096 Sep 14 17:53 .
drwxr-xr-x. 5 root    root    4096 Sep 14 17:16 ..
-rw-------. 1 stefanl stefanl  303 Sep 14 18:16 .bash_history
-rw-r--r--. 1 stefanl stefanl   18 May 26 08:46 .bash_logout
-rw-r--r--. 1 stefanl stefanl  176 May 26 08:46 .bash_profile
-rw-r--r--. 1 stefanl stefanl  124 May 26 08:46 .bashrc
-rw-rw-r--. 1 stefanl stefanl    0 Sep 14 17:46 foo

In addition, as root I can su to my account and it seems to work fine. If I didn't have permission to chdir to this directory, I would expect to see an error.

[stefanl@localhost ~]$ pwd
[stefanl@localhost ~]$ touch bar
[stefanl@localhost ~]$ 

Why do I get an error during the initial login, but then I can cd to that same directory immediately afterwards?

share|improve this question
What is the output of ls -ld /homedir/stefanl? – quanta Sep 15 '11 at 2:04
@quanta I updated my answer to show the output of ls -la – Stefan Lasiewski Sep 15 '11 at 16:14
up vote 5 down vote accepted

It could be an SELinux issue. Check /var/log/audit/audit.log for any related messages. See this informative post for more information, including a possible fix:

# chcon -t home_root_t /homedir/stefanl
share|improve this answer
That certainly looks like my problem. But I don't see this error in audit.log (but that log is hard to comprehend). I thought that selinux was disabled on this box. – Stefan Lasiewski Sep 15 '11 at 16:28
Ah yes, this issue is triggered by selinux. /etc/sysconfig/selinux had SELINUX=enforcing, and I changed this to SELINUX=permissive, then rebooted this host. – Stefan Lasiewski Sep 15 '11 at 16:31

The correct command without setting SELinux to permissive is: #chcon -t home_root_t /homedir (note the missing stefanl directory)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.