LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Change owner, group and permission settings on file and folder creation?? (https://www.linuxquestions.org/questions/linux-newbie-8/change-owner-group-and-permission-settings-on-file-and-folder-creation-606496/)

helptonewbie 12-13-2007 05:57 AM

Change owner, group and permission settings on file and folder creation??
 
Hello,
I've got a system here were web developers can ftp into the web box and of course add change edit files. What i want to be able to do is automatically no matter which webdev user is logged in, to automatically when file and folders are added into the web root folder with permissions:
owner:apache
group:webdev
other:r-x

I would like all files and folders created to take on the same permissions as this, no matter what i do it seems the file always ends up being owned by the user that put it in place this is no good as i want apache to be the owner and webdev to be the group, this will then stop anyone in the webdev group from being able to change the permissions of the files and folders as they are not the owner of apache is the owner

Any ideas? SGID sets group fine so that done basically, but SUID doesn't set user as owner for anything created?? within the folder..

I'd want this to take place automatically and not via a script that runs every so often if i was going to do it that way i could do it myself, chown -R owner:group /folder

I hope this is possible, i'm using vsftp maybe i should try setting up virtual users??

Regards

shadowsnipes 12-14-2007 01:03 AM

this thread may be of some help
http://www.linuxquestions.org/questi...folder-605129/

helptonewbie 12-14-2007 06:47 AM

All they do at the end of it in that post is to SGID, i've already done that, the issue i'm having is to do a similar thing but with the username (or OWNER) of files and folders inside a directory. No its not as simple as SUID..

Regards

shadowsnipes 12-14-2007 10:11 AM

I wasn't referring to that. Did you actually read the entire post? Look at the ACL section.

mattydee 12-16-2007 05:37 PM

helptonewbie
Just out of curiosity, why do you trust users to delete the files but not change their permissions?

shadowsnipes, I'm not sure acl will do this since it takes care of permissions not ownership... you would think setting uid would do the trick... I've tried it also, but it doesn't seem to work.

gd2shoe 12-16-2007 08:30 PM

I would look into doing this through your ftp server's configuration. Which ftp server are you using? Have you read through the config file's documentation yet?

acid_kewpie 12-17-2007 02:29 AM

nothign to do with networking. moved to Linux - Newbie.

helptonewbie 12-17-2007 03:07 AM

Quote:

helptonewbie
Just out of curiosity, why do you trust users to delete the files but not change their permissions?

shadowsnipes, I'm not sure acl will do this since it takes care of permissions not ownership... you would think setting uid would do the trick... I've tried it also, but it doesn't seem to work.

Web dev's know how to make web files but most sure don't know much about permissions, its not that they may set them wrong although that is true also its that their ftp clients of which vary can set the permissions on the files once uploaded and this gets around that problem. Of which is now sorted taken ages to find what was required.


Yes i agree SUID thought would work but it does apparently on freeBSD!!

The first reason why i wasn't doing it through the ftp client was because the ftp clients method of umask settings wasn't working as a umask like expected which was abit useless, but found another parameter thats almost un-related that has fixed the issue.


Setting (vsftpd):-
file_open_mode=0777
local_umask=002
chmod_enable=NO


it was the file_open_mode that sorts out the issues with the umask problem, which then allowed me to use the chmod_enable no, so more or less sorted now to a point i can work with.

Regards

gd2shoe 12-17-2007 12:44 PM

That's where I'd suggest dealing with this problem. For the record, vsftpd is an ftp server, not an ftp client.

For a reference, use:
man vsftpd.conf

helptonewbie 12-17-2007 03:03 PM

i'm fully aware what vsftpd is i installed and set it up, just had an annoying problem which caused all this in the first place with the stupid way the umask doesn't work properly unless you use the:
file_open_mode=0777 but its not very well documented any where, or it took me ages to find that this would also be required so the umask would work how i wanted it to.

I'm talking about ftp clients because upon upload the clients where changing the file permissions on the file they uploaded to something useless, and i wanted to stop this and now i have


All times are GMT -5. The time now is 06:25 PM.