1

I am trying to create a directory as a root in /home but I get the following error:

mkdir: cannot create directory `foo': Permission denied

I have checked the permissions by running ls -ld /home is :

drwxr-xr-x 2 root root 0 May 11 10:46 /home/  

I was also seeing in other posts that it might be an issue related to the mounting so I run 'mount' and this is the output:

/dev/mapper/trusty--vg-root on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu type cgroup (rw,relatime,cpu)
cgroup on /sys/fs/cgroup/cpuacct type cgroup (rw,relatime,cpuacct)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,relatime,freezer)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,relatime,perf_event)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,relatime,hugetlb)
/dev/xvda1 on /boot type ext2 (rw)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)

I have also tried to create a user using sudo adduser testuser --home testuser and it failed with the following output:

nimbadmin@trusty:/home$ sudo adduser testuser --home testuser
adduser: The home dir must be an absolute path.
nimadmin@trusty:/home$ sudo adduser testuser --home /home/testuser
Adding user `testuser' ...
Adding new group `testuser' (1001) ...
Adding new user `testuser' (1001) with group `testuser' ...
Creating home directory `/home/testuser' ...
Stopped: Couldn't create home directory `/home/testuser': Permission denied.

Removing directory `/home/testuser' ...
Removing user `testuser' ...
Removing group `testuser' ...
groupdel: group 'testuser' does not exist
adduser: `groupdel testuser' returned error code 6. Exiting.

Any suggestions? I would appreciate any explanation of how permissions might be the problem.

migrated from stackoverflow.com May 26 '15 at 17:24

This question came from our site for professional and enthusiast programmers.

  • Please request migration to unix.stackexchange.com – Barmar May 5 '15 at 1:02
  • You showed the permissions of a directory named user, not home. Try ls -ld /home to show the directory itself, not its contents. – Barmar May 5 '15 at 1:03
  • The output of ls -ld /home is : drwxr-xr-x 3 root root 0 May 4 21:58 /home – user3711775 May 5 '15 at 5:23
  • Edit the question – Barmar May 5 '15 at 5:25
  • I have added more info to the question – user3711775 May 11 '15 at 18:49
1

You can follow these steps in linux:

  1. whoami (display your USERNAME)

  2. groups [username] (print group memberships for each USERNAME)

  3. sg [group membership] (change the group identification of its caller in the current process)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy