Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a folder I'd really like to allow another user on this machine access to. I'm using mt-daapd to serve music to the network, so I'd like to enable the mt-daapd user to access my Music directory, /home/rfkrocktk/Music. The master user is rfkrocktk obviously. I've tried to set all of my permissions properly on the directory, but the mt-daapd user can't acces the files.

I created a group called media-users and added both rfkrocktk and mt-daapd to it in order to give mt-daapd permission to simply read all of the files in that directory and subdirectories.

If I run id on each of my users, here's what's displayed:

$ id rfkrocktk
> uid=1000(rfkrocktk) gid=1000(rfkrocktk) groups=1000(rfkrocktk),4(adm),20(dialout),24(cdrom),29(audio),46(plugdev),104(lpadmin),115(admin),120(sambashare),124(vboxusers),1001(jupiter),2002(media-users)

$ id mt-daapd
> uid=123(mt-daapd) gid=65534(nogroup) groups=65534(nogroup),2002(media-users)

It definitely seems that both users are a part of the media-users group, so what could be going wrong?

If I run ls -l on the actual Music directory to see its permissions, here's the output:

drwxr-Sr-- 201 rfkrocktk media-users 12288 2011-01-13 12:26 Music

If I run ls -l on the Music directory to get its children, here's the output:

drwxr-Sr--  3 rfkrocktk media-users 4096 2010-12-20 15:31 2DBoy
drwxr-Sr--  3 rfkrocktk media-users 4096 2010-05-25 12:50 ABBA
drwxr-Sr--  3 rfkrocktk media-users 4096 2009-12-28 15:19 Access Denied
drwxr-Sr-- 10 rfkrocktk media-users 4096 2009-12-28 15:19 AC-DC
drwxr-Sr--  3 rfkrocktk media-users 4096 2009-12-28 15:19 Aerosmith
drwxr-Sr--  3 rfkrocktk media-users 4096 2010-06-04 10:45 A Flock of Seagulls
drwxr-Sr--  4 rfkrocktk media-users 4096 2010-05-28 18:13 Alestorm
drwxr-Sr--  3 rfkrocktk media-users 4096 2010-06-22 23:29 Amon Amarth
drwxr-Sr--  5 rfkrocktk media-users 4096 2009-12-28 15:19 Anberlin
...

From this, it would seem that I should be able to access the folders from mt-daapd, but I can't. Running sudo -i -u mt-daapd ls -l /home/rfkrocktk/Music displays nothing, indicating to me that for whatever reason, mt-daapd doesn't have access to read the folder. What am I doing wrong?


EDIT

A problem I was having involved the "S" flag. It needs to be "s", so that execute permissons for the group also exist on the files and folders. Additionally, the invocation of sudo -i -u mt-daapd ls -l /home/rfkrocktk/Music was wrong. It should be sudo -u mt-daapd ls -l /home/rfkrocktk/Music instead. Evidently, the -i parameter kills the stdout.

share|improve this question
up vote 4 down vote accepted

You are missing execute permission on the directory. chmod g+x dir.

Other users also have read access but not execute. If you chmod o+g dir, then you don't need to muck about with groups because everyone will be able to read it.

share|improve this answer
    
That fixed it! Now, could you explain why I need execute permissions? I would assume that being able to read would be good enough. ALSO: One of the problems I had was in my invocation to list the directory as mt-daapd. I needed to omit the -i parameter as this kills all output. Thus, it's better to use something like this: sudo -u mt-daapd ls -l /home/rfkrocktk/Music. Thanks for the help! – Naftuli Tzvi Kay Jan 13 '11 at 23:48
2  
You need execute permission to traverse a directory and access its contents. Read permission lets you read the directory, aka. list its contents. Sometimes you want to let people access a file they know is there, but not list what files are there. – psusi Jan 14 '11 at 2:35

You must log in to answer this question.

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