'Could not chdir to home directory /home/[user]: Permission denied'
I have a secondary disk which holds a /home directory structure from a previous install of Linux. I installed a new version on a new primary drive and mounted this secondary drive as the new /home. Problem is, even though the users are the same names and I can access the home directories for the users, I cannot login directly to their home directories, as I get the following error: -
Code:
login as: [me] What have I broken? :) |
Have you tried using chown as root to change the ownership?
What are the permissions set as? Post the output from Code:
ls -la /home/ |
The problem is most likely related to the user and group IDs. When you create a user it is given a userid and a primary group ID. This information is stored in /etc/password normally (unless you use some form of network based authentication).
If you look at /etc/passwd you will see a number of user entries, below is a sample for some of the passwd file users on my system Quote:
I am guessing the previous system on which the /home directories were originally created had assigned different user id's in the password file. As devnull10 recommends the chown command can be used to change the owner and is probably a simpler way of fixing the access than trying to change the user ids in the /etc/passwd file because other files on the linux system will be using the new user id. |
The output: -
Code:
[jon@joshua11 /]$ ls -la /home/ chown -R 500:500 /home/jon ...but this doesn't seem to change the login problem, although I *do* have ownership of the files and directories as this user. Am I somehow missing changing the UID and GID for the hidden files even though the username is the same? Something that used the previous UID and GID in whatever scripts automatically moves your location to your home directory when you login? Thanks for your patience. |
The syntax of chown is:
Code:
chown [user] [dir] Code:
chown -R jon /home/jon/ |
I have already tried that to no effect. Login problem persists. Hidden files appear to have changed, but since both usernames are the same, it's hard to tell.
|
Quote:
I've also done chgrp -R 500 /home/jon (and tried substituting "500" for "jon") to no effect. I have acces to the home directory as that user, just not able to automatically login to the home directory. It fails and I have to do "cd /home/jon" after logging in. |
You could try creating a new home directory when logged in as root for the user jon. The following command will modify the user to have the home directory /home/jon_home (it will be created if it doesn't already exist). The -m flag will copy the contents of your existing home into the new directory.
Code:
usermod -d /home/jon_home -m |
The following command will show what user/group id's are set on the directory
ls -ln /home Is the version of linux the same as the one you had previously installed. When you create a user a default set of files are copied into the users home directory from the directory /etc/skel It could be that your .bash_profile .cshrc or other login files are what is causing the directory failure. It would be worth looking at these files to see if they are causing issues. The other thing that occurs is can you run the command cat /etc/fstab | grep /home This will list the entry for the /home partition showing the mount options that have been used to mount it. Regards Lee |
Thanks Cardy - that shows a little more information on /home: -
Code:
drwx------. 32 500 500 4096 2010-01-06 19:52 jon Code:
jon:x:500:500:Jonathan:/home/jon:/bin/bash Code:
/dev/sdb1 /home ext3 defaults 2 1 I couldn't see anything amiss with .bashrc or .bash_profile or anything like that, but it is definitely something to do with login. |
Have you checked the following:
The output of the command Quote:
Check the following files. Quote:
Regards Lee |
Output of secure log: -
Code:
Jan 6 22:53:44 joshua11 sshd[6194]: Accepted password for jon from [IP ADDRESS] port 2143 ssh2 |
Very odd looking problem you have there. Could it be a SELinux context issue?
Try looking at the output of these: # ls --context /home # ls --context /home/jon If not SELinux, it could also be an ACL issue. Try: # getfacl /home |
Quote:
Code:
[root@joshua11 ~]# ls --context /home |
Could it be the change from x86 to x86_64? Maybe some architecture incompatibility?
|
All times are GMT -5. The time now is 11:40 AM. |