5

I have a group called homeperms on an Ubuntu system, with a few users:

$ cat /etc/group | grep "homeperms"
homeperms:x:1004:jorik,tim.wijma,vanveenjorik,jorik_c

And I've done $ sudo chgrp -R homeperms /home. But when I try to

md /home/flask.

I get a permission denied error (Happens with any other folder name too).

I don't want to 777 the folders since I'm going to be dealing with web server stuff.

Permissions of home in /

drwxr-xr-x  12 vanveenjorik homeperms  4096 Jul  6 09:06 home

permissions inside /home:

drwxr-xr-x 6 vanveenjorik         homeperms 4096 Jul  3 20:08 19150
drwxr-xr-x 3 codeanywhere-ssh-key homeperms 4096 Jul  6 08:00 codeanywhere-ssh-key
drwxr-xr-x 2 vanveenjorik         homeperms 4096 Jul  6 09:13 downloads
drwxr-xr-x 5 vanveenjorik         homeperms 4096 Jul  4 08:43 jorik
drwxr-xr-x 4 jorik_c              homeperms 4096 Jul  6 08:09 jorik_c
drwxrwxr-x 4 vanveenjorik         homeperms 4096 Jul  3 20:15 mkdir_python
drwxr-xr-x 5 vanveenjorik         homeperms 4096 Jul  4 09:09 tim.wijma
drwxr-xr-x 3 vanveenjorik         homeperms 4096 Jul  3 18:20 ubuntu
drwxr-xr-x 5 vanveenjorik         homeperms 4096 Jul  4 09:27 vanveenjorik
drwxrwxr-x 3 vanveenjorik         homeperms 4096 Jul  3 22:28 venvs

I am trying to do this on the user 'jorik_c' and with sudo this (of course) works flawlessly

Before this gets marked as duplicate, the answer to this question, didn't help.

4 Answers 4

5

By typing the command chgrp -R homeperms /home , You effectively changed the group ownership of /home and everything underneath to homeperms.

BUT, the group still does not have WRITE access on the directory. Per your output:

drwxr-xr-x  12 vanveenjorik homeperms  4096 Jul  6 09:06 home

Remember, file permissions display as: OWNER, GROUP, EVERYONE ELSE
You can fix it quickly by any of the following:

# retaining (rewriting) your existing permissions + toggling the WRITE-ACCESS bit for GROUP
chmod 776 /home

# similar, accomplished the same but simplified
chmod g+w /home
3

If the group was just created the user must re-login in order for the group's permissions to be applied.

su -l $USER 

su changes the effective user. -l indicates that we should make this new shell into a login shell $USER is a environment variable which should always be your user. Same results as whoami

Related

11
  • @Peregrino69 The su command is used to become another user during a login session. As mentioned in the answer if the group was just created the user must re-login in order for the group's permissions to be applied. so if you re-login as the same user, you will get the permission to do the changes.
    – mint
    Commented Sep 28, 2021 at 15:09
  • Sorry, yes "only other answer" part removed. I had same issue after creating a new directory and assigned to a group. I resolved it by re-login with same user.
    – mint
    Commented Sep 30, 2021 at 6:53
  • Yap, now it's clear even to me :-) Except that is su -l $USER really the way to re-login, as you're now implying? Commented Sep 30, 2021 at 6:57
  • I used that to re-login and to make new shell
    – mint
    Commented Oct 1, 2021 at 7:34
  • I just tried su -l pg on my system (Debian 10 without significant tweaking) - xmodmap says unable to open display and login fails. So while it is valid way to login as a different user, it's not always a valid way to re-login as the same user. Commented Oct 1, 2021 at 7:50
0

The ls -l shows that your group has only rx permissions on home dir. I think w permission is required for creating anything in the folder.

You can achieve this using the command: $ sudo chmod g+rwx /home

0
0

As mentioned in other answers making sure your group permissions are correct is a vital step.

chmod g+w /home

However if you're still seeing this after those also match it could be that you added the user to the group during the same session. A log out/login will fix this error.

You can view the current session user's effective groups by executing the id command.

example

$ id
uid=1000(robert) gid=1000(robert) groups=1000(robert),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),109(netdev),998(docker),1001(appadmin)

See this post for detailed answer. https://askubuntu.com/questions/455000/group-permissions-allow-but-still-get-permission-denied

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .