LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-03-2012, 12:03 AM   #1
dmz1213
Member
 
Registered: Aug 2012
Posts: 40

Rep: Reputation: Disabled
Could not chdir to home directory; permission denied


Hello:
An user id u01 on a CentOS 6 server fv18:
u01:x:501:501:user 01:/sahome/u01:/bin/bash
From a remote server, ssh to it:
$ ssh -l u01 fv18
u01@fv18's password:*****
Could not chdir to home directory /sahome/u01: Permission denied

On server fv18, the home directory /sahome/u01 is:
drwx------. 4 u01 u01 1024 Sep 2 21:40 u01
sahome’s permission is
drwxr-xr-x. 5 root root 1024 Sep 2 21:53 sahome
sahome itself is a logical volume:
LV Name /dev/vg0/sahome
VG Name vg0
LV Write Access read/write
LV Status available
# open 1
LV Size 100.00 MiB
Current LE 25
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:6
Both servers are CentOS 6. On fv18, # su – u01 works fine.
Have a good holiday.
Warren
 
Old 09-03-2012, 12:28 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Check logs eg /var/log/messages, /var/log/secure.
Also, check /etc/ssh/sshd_config for eg chroot settings
 
Old 09-03-2012, 12:52 AM   #3
dmz1213
Member
 
Registered: Aug 2012
Posts: 40

Original Poster
Rep: Reputation: Disabled
Hello:
Update:
ssh actually logs into fv18 as u01. With the chdir error, it puts on "/" instead.
From "/", user u01 can issue command cd to jump to its own home directory...

$ ssh -l u01 fv18
u01@fv18's password:
Last login: Sun Sep 2 22:42:10 2012
Could not chdir to home directory /sahome/u01: Permission denied
[u01@fv18 /]$ pwd
/
[u01@fv18 /]$ cd
[u01@fv18 ~]$ pwd
/sahome/u01

Under u01, manually run
$ . ./.bash_profile
$ . ./.bashrc and
$ . /etc/bashrc all completes without error.

There is no error or warning on /etc/log/messages and /var/log/audit.
Thanks.
Warren
 
Old 09-03-2012, 12:59 AM   #4
em31amit
Member
 
Registered: Apr 2012
Location: /root
Distribution: Ubuntu, Redhat, Fedora, CentOS
Posts: 190

Rep: Reputation: 55
did you get a chance to check SeLINUX, here ls showing "." at the end of file permission, that means SeLinux is there. if all permission looks good than it is selinux which is preventing to change the directory. you must look into selinux

checkout what /var/log/audit/audit.log says..
 
Old 09-03-2012, 04:57 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Actually a dot at the end means acls eg getfacl.
You can check SELinux with
Code:
ls -lZ
That would indeed be /var/log/audit, but I asked about /var/log/secure, which is where ssh logs to (or messages if the file does not exist).
Also, as I said, check sshd_config, as this happens (as you have shown) when logging in via ssh.
 
Old 09-03-2012, 01:16 PM   #6
dmz1213
Member
 
Registered: Aug 2012
Posts: 40

Original Poster
Rep: Reputation: Disabled
I set SELinux on fv18 to permissive, then ssh to fv18 as u01 works fine without the chdir error.
It appears the file system /sahome has access restrictions. If i change u01's home directory to /home, ssh does not have any issue regardless of SELinux's setting.

Where /home is a sub-directory; /sahome is a file system.

W
 
Old 09-03-2012, 02:02 PM   #7
dmz1213
Member
 
Registered: Aug 2012
Posts: 40

Original Poster
Rep: Reputation: Disabled
I define/reset SELinux security context on /sahome.
# restorecon -R -v /sahome
# ls-Zd /sahome
drwxr-xr-x. root root system_ubject_r:home_root_t:s0 /sahome

u01 is able to ssh to fv18 without chdir error.

Thanks.
Warren
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Home Directory Permission Denied sunveer Linux - Newbie 1 08-18-2012 07:23 PM
[SOLVED] 'Could not chdir to home directory /home/[user]: Permission denied' arashi256 Linux - Newbie 25 11-11-2011 09:29 AM
chdir to home folder: permission denied when I use ssh zarzor_2010 Linux - Newbie 2 09-13-2010 01:07 PM
NFS problem: "Could not chdir to home directory /home/USER: Permission denied" sumanc Linux - Server 4 07-22-2010 04:12 PM
permission denied to home directory ekdya Debian 3 11-08-2005 04:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration