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
joggxAsked:
Who is Participating?
 
rgeersCommented:
This system has a serious configuration problem and can be fixed by running from a rescue cd. You then log in as root, fix the password files and restart the system. You know how to run chroot to your target os? I think perhaps ubuntu does this now automatically, but it's some time ago since i ran this.
0
 
larsrohrCommented:
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)
0
 
joggxAuthor Commented:
@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
0
On-Demand: Securing Your Wi-Fi for Summer Travel

Traveling this summer?Check out our on-demand webinar to learn about the importance of Wi-Fi security and 3 easy measures you can start taking immediately to protect your private data while using public Wi-Fi. Follow us today to learn more!

 
larsrohrCommented:
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

0
 
mccrackyCommented:
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
0
 
joggxAuthor Commented:
@mccracky:

> Also, is the user's home directory really what you think it is?
yes it is.
0
 
mccrackyCommented:
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.
0
 
joggxAuthor Commented:
@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:

0
 
joggxAuthor Commented:
It is a VPS and I have switched to fedora and everything works fine.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.