• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Linux file permissions

CareBear

NLC
NLC
I'm struggling with file permissions under Linux; there doesn't seem to be any way to keep the file owner from changing permissions on a file or directory or to automatically assign rights to newly created subdirectories. :confused4

What I need: to create a bunch of user directories while another user still has list access so disk usage and files stored can be monitored with a cron job. This is under shared hosting, so running as root is out of the question.

Under NTFS this would be easy: create the user's directory, add the user with the full permission set except deny change permissions on the main directory and any subdirectories and assign ownership of the directory to the user. Then add the monitoring user with traverse and list folder rights on the main directory and any subdirectories.
If the user should create any subdirectories, list permission would automatically be assigned to the monitoring user since the permissions are recursive.

Under Linux I could create the folder and chmod it to 740 with the monitoring user as the group, but as far as I understand it, nothing's keeping the user from changing it to 700.
Even if they don't manually change it, any newly created subdirectories wouldn't have the group permissions applied to them.

Edited to add that impersonating each user to get a directory listing would be a possible - if not desireable - solution, but Linux seems to lack that capability as well. :eek2:
 
Last edited:
I think this should work? :confused4

In a shell session, under my account, with a new user called testuser and a group called testusergroup which only testuser and the monitoring user belong to.

mkdir testuser
chmod 2774 testuser
chgrp testusergroup testeruser

As far as I understand it, testuser shouldn't be able to change the file permissions on the user directory since it doesn't own it. The setgid on the directory should make sure new files and directories are owned by the testusergroup, giving the monitoring user permission to list files in any subdirectories.

The only thing that isn't clear is whether testuser can deny read permission on any subdirectories it creates with chmod g-r.
 
Last edited:
I expected that at least one person would have been able to answer what is a basic security question :S
The more I learn about Linux, the less I see it as a mature OS.

Now on to the rewarding task of explaining to people why their FTP access has been revoked because Linux lacks decent file permissions. :mad:
 
Back
Top