[SOLVED] adduser: cannot create directory /home/user

General support questions including new installations
xeugene123x
Posts: 14
Joined: 2011/10/27 06:22:07
Contact:

[SOLVED] adduser: cannot create directory /home/user

Post by xeugene123x » 2011/10/27 06:31:18

I'm receiving this error and I've been trying to figure out how to get rid of it.

When I try to login to another account beside root I get this error.

Could not chdir to home directory /home/user : permission denied
/bin/bash: Permission denied

Thanks

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: adduser: cannot create directory /home/user

Post by TrevorH » 2011/10/27 08:20:33

What are the permissions on /home/user? If you created the directory manually as root then it's probably owned by root and the user has no access to it - you'd need to chown -R it to the correct ownership.

xeugene123x
Posts: 14
Joined: 2011/10/27 06:22:07
Contact:

Re: adduser: cannot create directory /home/user

Post by xeugene123x » 2011/10/27 10:37:54

Thanks Trevor!

I have made the directory under root and I guess that the reason why I can't access it. I have set the chmod to 777 on both files but it's not

I have also tried chown -R user /home

I still seem to be getting the same errors?

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: adduser: cannot create directory /home/user

Post by TrevorH » 2011/10/27 10:48:51

[quote]
I have also tried chown -R user /home
[/quote]

Ouch, that doesn't sound right. /home should be owned by root:root with permissions 755. Each user's subdirectory in /home should be owned by their userid:group. Perhaps you can post the output of

[code]
ls -la /home
ls -laZ /home
[/code]

xeugene123x
Posts: 14
Joined: 2011/10/27 06:22:07
Contact:

Re: adduser: cannot create directory /home/user

Post by xeugene123x » 2011/10/27 10:54:47

Ahh I see now.

Heres what I got for for ls-la /home I got the following.

[quote]total 16
drwxrwxrwx 3 user root 4096 October 27 03:41 .
drwx-------- 25 root admin 4096 October 27 03:40 ..
drwxrwxrwx 2 user root 4096 Oct 27 03:41 user

[/quote]

[quote]drwxrwxrwx user root .
drwx------- root admin system_u:object_r:root_t:s0 ..
drwxrwxrwx user root user

[/quote]

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: adduser: cannot create directory /home/user

Post by TrevorH » 2011/10/27 11:09:49

So let's start by putting things back how they should be...

[code]
chmod 755 /home
chown root /home
chmod 755 /home/user
chown -R user:user /home/user
[/code]

From the output of your ls -laZ I am guessing that you have disabled SELinux?

For the original problem, how exactly are you logging in? Is it at a text console? Using a GUI login prompt? Or over ssh?

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

[SOLVED] adduser: cannot create directory /home/user

Post by gerald_clark » 2011/10/27 14:35:00

drwx-------- 25 root admin 4096 October 27 03:40 ..

That is / and should be:
drwxr-xr-x 25 root root 4096 Sep 15 12:31 ..

xeugene123x
Posts: 14
Joined: 2011/10/27 06:22:07
Contact:

Re: adduser: cannot create directory /home/user

Post by xeugene123x » 2011/10/27 17:16:24

I currently have selinux disabled.

I was logged into the kvm.

I can now copy paste exactly, and have changed the permissions to this now


# ls -la /home
total 16
drwxr-xr-x 3 root root 4096 Oct 27 10:01 .
drwx------ 25 root root 4096 Oct 27 03:40 ..
drwxr-xr-x 2 User User 4096 Oct 27 10:01 User
# ls /home



-laZ /home
drwxr-xr-x root root .
drwx------ root root system_u:object_r:root_t:s0 ..
drwxr-xr-x User User User


Thanks guys for the help!

xeugene123x
Posts: 14
Joined: 2011/10/27 06:22:07
Contact:

Re: adduser: cannot create directory /home/user

Post by xeugene123x » 2011/10/27 17:33:44

got it to work!

It was my directory /

I set the chmod to 755 and it worked!

Thanks guys for all the help

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: [SOLVED] adduser: cannot create directory /home/user

Post by pschaff » 2011/10/27 20:43:21

Thanks for reporting back. Marking this thread [SOLVED] for posterity.

Post Reply