Linux Permissions - SSHFS

Quote from Spiceworks.
I recently have been working on remote linux machine and had permission issues due to the setup and it not seeing me as in the group locally. (sshfs mount)
Here is what I came up with.
BASH
#!/bin/bash
# set group and default username
sudo chown -R username:group /var/www/vhosts
# group sticky bit so files retain group permissions
sudo find /var/www/vhosts -type d -exec chmod g+s {} \;
# read / write for group and owner, read for other
chmod -R 0664 /var/www/vhosts
# set all the directories to be accessible
# directories need to be executable to see the files within
sudo find /var/www/vhosts -type d -exec chmod 775 {} +
# set all executable php and bash files to be executable by group and user
sudo grep -R '#!/' * | awk -F ":" "{print \$1}" | xargs chmod 0774
I also had to mimic the groupid on my local machine and add my user to that group.

Popular Posts