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

linuxpermissionsUbuntu

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@192.168.1.123
and I get Could not chdir to home directory /opt/scm: Permission denied.

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

Best Answer

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

sudo chmod ug+x scm