Solved

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

Posted on 2010-09-23
9
2,049 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
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 get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

911 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

21 Experts available now in Live!

Get 1:1 Help Now