Knowledgebase

Check the owner of a directory

Posted by Bluz, 10-16-2009, 12:44 PM
How do I go about seeing who currently owns a file/folder? In a ftp program I can see it's owned by www root but when I go to change that owner to say www bob i get a invalid user " www ". The webserver is lighttpd so if anyone could help that'd be great. Ok, found out lighttpd is www-data, but this user is having troubles uploading files and if I change the group or owner from www-data then the script cannot perform it's functions, is there a setting in proftp to override this? Last edited by Bluz; 10-16-2009 at 12:54 PM.

Posted by eth10, 10-16-2009, 01:10 PM
ls -lad give us the output

Posted by Bluz, 10-16-2009, 01:33 PM
drwxr-xr-x 5 www-data www-data 4096 2009-10-16 would it be ok to put the user in the www-data group?...Would that work for fixing this?

Posted by madaboutlinux, 10-16-2009, 02:59 PM
Rather than putting the user in the "www-data" group, create a new group and add the "www-data" usre and the user (bob) in the new group and assign it to your files that need "www-data" as the user. The reason I said not to add the user(bob) in the "www-data" group because the user will have access to all those files that will have "www-data" as their user. BTW, you will have to carry out all these steps as a root user.

Posted by eth1, 10-16-2009, 03:00 PM
The best and recommended approach to this problem is to run PHP as CGI(suexec), that way PHP scripts get executed as the respective user of the account. You can then keep the ownership of the folder and user.user and PHP scripts would still be able to write to the directory. The insecure way of doing this would be to grant ownership of user.www-data to the folder and permissions 775 recursively but then you're opening a huge security risk by doing that.

Posted by Bluz, 10-16-2009, 03:15 PM
The thing is, several users all use this script. So there's say 10 users to the one script.



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
scp issue (Views: 537)


Language:

Client Login

Email

Password

Remember Me

Search