Link to home
Start Free TrialLog in
Avatar of Member_2_5139014
Member_2_5139014

asked on

ubuntu user ssh login error 'Could not chdir to home directory permission denied'

On Ubuntu I could ssh to log in as root but after creating a user I can't log in as that user and get the following error:

Could not chdir to home directory permission denied

Another strange thing is sudo is not possible too:

sudo: can't open /etc/sudoers: Permission denied
Avatar of larsrohr
larsrohr
Flag of United States of America image

Does the home directory for this user exist, and is it owned by that user?

What are the permissions on /etc/sudoers?  (ls -l /etc/sudoers)
Avatar of Member_2_5139014
Member_2_5139014

ASKER

@larsrohr

Yes the home directory for this user exists, chmod 755, group and owner are all the user itself.

ls -l /etc/sudoers

-r--r----- 1 root root 481 2009-09-20 18:37 /etc/sudoers
Have you changed any directory permissions?

The following should especially be checked:
ls -ld /
ls -ld /etc /usr /usr/bin /usr/sbin
and any directories in the path to the user in question, e.g.:
ls -ld /home /home/user

Also, is the user's home directory really what you think it is?

The second to the last item of this shows what the system thinks is the home directory:

grep <username> /etc/passwd
@mccracky:

> Also, is the user's home directory really what you think it is?
yes it is.
Oh, I think it has to do with the way ubuntu is set up.  IIRC, ubuntu only has the first user enabled to use sudo as an admin  user.  By default all other users are created without admin rights.  Check what groups the new user is in in the /etc/group file.
@mccracky:

the problem is event under root I can't run sudo, and get the permission error.

the /etc/group has the top line:

root:x:0:

ASKER CERTIFIED SOLUTION
Avatar of rgeers
rgeers

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It is a VPS and I have switched to fedora and everything works fine.