Solved

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

Posted on 2010-09-23
9
1,993 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:joggx
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 12

Expert Comment

by:larsrohr
ID: 33750781
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
 

Author Comment

by:joggx
ID: 33750850
@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
 
LVL 12

Expert Comment

by:larsrohr
ID: 33750873
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
 
LVL 12

Expert Comment

by:mccracky
ID: 33754959
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
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 

Author Comment

by:joggx
ID: 33755045
@mccracky:

> Also, is the user's home directory really what you think it is?
yes it is.
0
 
LVL 12

Expert Comment

by:mccracky
ID: 33755076
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
 

Author Comment

by:joggx
ID: 33759214
@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
 
LVL 3

Accepted Solution

by:
rgeers earned 125 total points
ID: 33762263
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
 

Author Comment

by:joggx
ID: 33762842
It is a VPS and I have switched to fedora and everything works fine.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now