Unable to create home directories
A couple of possibilities:
-
/home
could be a filesystem which is mounted readonly (themount
command would show you this) - as an exercise, your instructor could have set some interesting ACL (but then
ls
should have shown a.
or other punctuation character after the permissions) - the VM (underlying file) permissions are readonly, and the machine cannot write-through its changes (so for instance, journalling might have died).
In a followup, OP showed the results from mount
:
411blackf16:/> mount | grep home
ldap:CN=auto.home,OU=Unix Autofs,DC=cs,DC=odu,DC=edu on /home type autofs (rw,relatime,fd=6,pgrp=1415,timeout=300,minproto=5,maxproto=ββ5,indirect)
and MikeA pointed out that
- the type is
"autofs"
, which shows that the filesystem is mounted, and - the string
"ldap:CN=auto.home,OU=Unix Autofs,DC=cs,DC=odu,DC=edu"
indicates that it is mounted using LDAP credentials. - all of this implies that the actual
/home
is on another machine that OP cannot modify (aside from files in his/her home-directory).
The root
user on the VM would not have any permissions on this filesystem (it would be treated as nobody
).
If you want to create local user accounts in the VM, with a local home directory, you can put their home directory in a different location. /home
is a very common convention, but not an absolute rule.
Further reading:
Related videos on Youtube
FantasticSponge
Updated on September 18, 2022Comments
-
FantasticSponge almost 2 years
For a school assignment our team has been provided a VM from the school. We were handed the VM with our user accounts added to the sudo group, and I also have access to the "root" and "sysadm" accounts that already exist on the machine, presumably from the sysadmin that did the setup.
I noticed an issue: I am unable to create any directories or files in the home directory.
411blackf16:/> ls -lashr total 93K 0 lrwxrwxrwx 1 root root 29 Sep 8 07:43 vmlinuz.old -> boot/vmlinuz-4.4.0-21-generic 0 lrwxrwxrwx 1 root root 29 Sep 8 18:35 vmlinuz -> boot/vmlinuz-4.4.0-36-generic 4.0K drwxr-xr-x 14 root root 4.0K Sep 12 18:16 var 4.0K drwxr-xr-x 10 root root 4.0K Sep 8 07:42 usr 4.0K drwxrwxrwt 10 root root 4.0K Sep 12 18:44 tmp 4.0K drwx------ 2 sysadm sysadm 4.0K Sep 12 18:44 sysadm 0 dr-xr-xr-x 13 root root 0 Sep 12 18:30 sys 4.0K drwxr-xr-x 2 root root 4.0K Apr 20 18:08 srv 4.0K drwxr-xr-x 2 root root 4.0K Apr 19 10:31 snap 12K drwxr-xr-x 2 root root 12K Sep 12 13:18 sbin 0 drwxr-xr-x 36 root root 1.4K Sep 12 18:32 run 4.0K drwx------ 3 root root 4.0K Sep 12 18:34 root 0 dr-xr-xr-x 219 root root 0 Sep 8 23:42 proc 4.0K drwxr-xr-x 2 root root 4.0K Sep 12 12:20 opt 4.0K drwxr-xr-x 2 root root 4.0K Apr 20 18:08 mnt 4.0K drwxr-xr-x 4 root root 4.0K Sep 8 07:42 media 16K drwx------ 2 root root 16K Sep 8 07:42 lost+found 4.0K drwxr-xr-x 2 root root 4.0K Sep 8 07:42 lib64 4.0K drwxr-xr-x 22 root root 4.0K Sep 12 18:22 lib 0 lrwxrwxrwx 1 root root 32 Sep 8 07:43 initrd.img.old -> boot/initrd.img-4.4.0-21-generic 0 lrwxrwxrwx 1 root root 32 Sep 8 18:35 initrd.img -> boot/initrd.img-4.4.0-36-generic 0 drwxrwxrwx 2 root root 0 Sep 12 19:03 home 4.0K drwxr-xr-x 106 root root 4.0K Sep 12 18:56 etc 0 drwxr-xr-x 19 root root 4.2K Sep 8 23:43 dev 1.0K drwxr-xr-x 4 root root 1.0K Sep 12 13:19 boot 4.0K drwxr-xr-x 2 root root 4.0K Sep 12 13:18 bin 4.0K drwxr-xr-x 24 root root 4.0K Sep 12 18:51 .. 4.0K drwxr-xr-x 24 root root 4.0K Sep 12 18:51 .
The owner is root:root.
411blackf16:/> sudo mkdir /home/test mkdir: cannot create directory β/home/testβ: Permission denied 411blackf16:/> sudo su root root@411blackf16:/# sudo mkdir /home/test mkdir: cannot create directory β/home/testβ: Permission denied
Using my sudo user account or the root account still doesn't allow creation of directory or files.
root@411blackf16:/# chmod -R 777 /home/ && touch /home/test touch: cannot touch '/home/test': Permission denied
Even opening up the permissions doesn't help. Does anyone have some any idea on what is going on here?
Thanks.
-
Byte Commander almost 8 yearsCan you provide the output of
lsattr /home
please? -
FantasticSponge almost 8 years@ByteCommander lsattr /home provides no output.
-
CJ Dana almost 8 yearshave you tried, sudo chown -R $(whoami) /home/
-
FantasticSponge almost 8 years@CJDana changing ownership or permissions doesn't work. The issue is that /home is mounted without write permissions as part of the school's ldap/non-standard image configuration.
-
-
FantasticSponge almost 8 yearsThis is the whole issue....no home directories exist. I should be able to create home directories for users.
-
FantasticSponge almost 8 years411blackf16:/> mount | grep home ldap:CN=auto.home,OU=Unix Autofs,DC=cs,DC=odu,DC=edu on /home type autofs (rw,relatime,fd=6,pgrp=1415,timeout=300,minproto=5,maxproto=5,indirect)
-
Marius almost 8 yearsre @mikea - sure, the point is that either the VM is treating
/home
as readonly, or the VM cannot write to a supposedly writable filesystem. -
FantasticSponge almost 8 years@ThomasDickey Are you able to discern anything from mount output? It appears to be a rw device but this is really outside of my domain and prior knowledge.
-
MikeA almost 8 yearsyour
/home
is getting mounted through autofs using a map in ldap. you won't be able to create home directories in/home
. they have to be created on some other source and added to the automount map to show up in/home
on your vm. you should add the info from your comment to the original post. -
FantasticSponge almost 8 yearsThat makes sense. I'll do some looking into how we can revert back to a standard /home configuration.
-
FantasticSponge almost 8 years@MikeA The thing I don't understand is that I have a home directory I use on the standard machines the school provides but in this case none of the home directories are being included on our VM , although we are using the same ldap authentication to login.
-
chrishollinworth almost 8 yearsUpvoted back to 0 for mentioning selinux and because you're new here, but next time pls read the question more carefully
-
Gilles 'SO- stop being evil' almost 8 years@symcbean Please do not give pity upvotes. This disrupts the site by making bad answers (and this one certainly is a bad answer: mostly irrelevant, and the rest is wrong) look ok. You are doing visitors a disservice by making them believe that this answer is useful.
-
MikeA almost 8 yearsif you want a local /home instead of automounts, stop and disable the autofs service. then you should be able to create home directories in /home. don't use 777 permissions on /home. if you want to get autofs working, that's a different question you should submit.