Permissions/groups setup [closed]

I have setup up a Group that includes a few users (mygroup) then have set the owner of a web directory to be apache and the group to be mygroup.

chown -R apache:mygroup /home/myweb

Then I have set permissions to

chmod -R 764 /home/myweb

The idea being all can view, apache can read,write and execute and mygroup can read and write.

But now when I try and use ssh2 in php to create a folder in /home/myweb it doesn’t work because of permissions.

The user ssh2 connects with is part of mygroup as is apache.

As far as I can tell I have the right settings.

Answer

The x permission on a directory determines whether you’re able to traverse into it, which is required to write files. If you want mygroup to have write permissions, it needs execute permissions as well. Additionally, a value of 4 will allow other users to see which files are in the directory, but unable to read the files, nor even see what the sizes are. You want 775 for the directories to accomplish what you’ve described.

Since what you really want is for files to have one set of permissions, and directories to have another, I would suggest you run these commands.

find /home/myweb -type f -exec chmod 764 {} \;
find /home/myweb -type d -exec chmod 775 {} \;

The first find command looks for all items of type f (Files) and executes chmod 764 for each match, replacing {} with the name of the file it found.

The second find does the same thing, except it looks for directories, and sets the permissions to 775.

Attribution
Source : Link , Question Author : Kline , Answer Author : Omnipresence

Leave a Comment