Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2010-09-23
9
2,126 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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
 

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Securing Azure Oracle instance of Linux VM 4 65
winscp where are logs stored 3 52
CentOS 7 Linux for HP DL380 G4 32Bits 7 47
IP 10.0.1.2 / 255.0.0.0 61 56
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…
BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (https://kb.isc.org/article/AA-01272), affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

829 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