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'm trying to set up a simple repository host on my linux server under "/opt/scm", but I'm getting this error when attempting to SSH in as my scm user.

Could not chdir to home directory /opt/scm: Permission denied

I thought that I understood directory permissions, but clearly I'm doing something wrong...

This is what I've done.

cd /opt
$ sudo mkdir scm
$ sudo chown scm:scm scm/
$ sudo su scm
$ chmod 660 scm/
$ ls -l 
    drw-rw---- 2 scm   scm   4096 Aug 28 10:03 scm

Then ssh in ssh scm@ and I get Could not chdir to home directory /opt/scm: Permission denied.

Shouldn't my scm user have access to the directory?

share|improve this question
up vote 5 down vote accepted

You are missing the executable bit, which allows you to enter the directory in the first place:

sudo chmod ug+x scm
share|improve this answer
Is that just what "executable" means on a directory then? – Chris Covert Aug 28 '12 at 14:42
@ChrisCovert yes, the x bit gives permission to "be in" the directory. Without it, you can't cd into the directory (or through it to a subdirectory, even if the subdirectory has x). – DerfK Aug 28 '12 at 15:03

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.