4

I just created a new user, and I want to give access to a folder.

I have done:

chmod -R 777 ./p

and this is the result

lisa@linux:/media$ ls -halt
drwxr-xr-x  27 root      root   4,0K dic 11 11:57 ..
drwxrwxrwx+  3 pierpaolo utenti 4,0K dic  8 23:48 p
drwxr-xr-x   3 root      root   4,0K set 10 12:20 .
lrwxrwxrwx   1 root      root     45 ago  5 01:22 .directory -> /etc/kubuntu-default-settings/directory-media

But still, i can not cd in to the folder (permission denied). Any idea how to approach this problem or debug it?

Edit:

getacl gives:

# file: p
# owner: pierpaolo
# group: utenti
user::rwx
user:pierpaolo:r-x
group::---
mask::rwx
other::rwx

Edit: The folder i want to access by the new user is a second hard disk that has been mounted in /etc/fstab using the following command:

UUID=FEB222A8B222657D /media/p/Seagate  ntfs-3g  defaults,windows_names,locale=it_IT.UTF-8  0 0
Pierpaolo
  • 151
  • Your folder has some extended attributes/ACL on, look At The + at the end of flags. List them with getfacl and/or lsattr. – Rmano Dec 13 '14 at 09:05
  • You have no permission for every group set in ACL. /media is a strange dir anyway, it is normally managed by udsiks --- why do you want to do things there? (Notice that these are normal settings set by udisks --- they are there so that when you mount a device only you have access to it). – Rmano Dec 13 '14 at 09:33
  • 1
    Well I mounted a second HDD in /media/p/Seagate. I was thinking to give it access to a second user using chmod, but then, am I doing it in the wrong way? – Pierpaolo Dec 13 '14 at 09:50
  • Yep. if you want to mount it in a stable way, use fstab, and I would mount it out of the /media directory. About giving access to more user, it depends too on how the disk is formatted. See https://help.ubuntu.com/community/InstallingANewHardDrive and http://askubuntu.com/questions/303497/adding-an-entry-to-fstab (and search for more, I am sure there are plenty here). – Rmano Dec 13 '14 at 10:33
  • NTFS file systems do not understand Unix user semantic. In principle, the disk should be mounted to give permission to anyone; you can look at man ntfs-3g to check the details. Given access to a group of users should be possible using the uid, gid, and umask parameters. – Rmano Dec 13 '14 at 12:18
  • 3
    This http://askubuntu.com/a/92866/16395 seems spot-on. – Rmano Dec 13 '14 at 12:35
  • What filesystem is on that disk? Post the data from the mount command. – Uwe Burger Dec 15 '14 at 17:39

2 Answers2

1

This happens because there is a directory higher in the tree where you do not have execute permission. If a parent directory has no execute permission for some user, then that user cannot stat any subdirectories regardless of the permissions on those subdirectories.

Example:

$ ls -l cake
drwxr-xr-x 2 zanna zanna 4096 Jul 12 11:43 brownies
$ chmod 666 cake
$ ls -l cake/brownies
ls: cannot access 'cake/brownies': Permission Denied

Even though I am the owner of the directory 'brownies' and all users have permission to read and enter it, I can't access it if its parent directory has no execute permission.

It's better to use groups to manage permissions than give to give directories 777 permission.

-2

acl are not exactly unix/linux standard. I know RH keeps trying to push them but they confuse more then they help. I would strip the ACL data and just use chmod/chown/chgrp.

setfacl --remove-all p   # see if that works.
csgeek
  • 1,659