Update permissions on folder to let user scp file there?
I have a folder named "webapps" with the following permissions:
$ ls -al /opt/tomcat
$ drwxr-x--- 7 tomcat root 4096 Aug 15 22:06 webappsI have a user which is part of the "tomcat" group:
$ groups
$ hamburgers sudo tomcatWhen I try to scp a file from my local machine to the /webapps folder on my server, I get a permission denied error:
scp -r /mymachine/test.war hamburgers@123.123.123.123:"/opt/tomcat/webapps/test.war"
scp: /opt/tomcat/webapps/test.war: Permission deniedI thought since user "hamburgers" was part of the "tomcat" group, they'd be able to do this. I can scp the same way to other folders on the server.
How could I change the permissions to get this to work?
Thank you
1 Answer
At the moment the group owner is root, not tomcat, so being in the tomcat group won't help hamburgers.
Change the group ownership to the tomcat group
sudo chown -R :tomcat /opt/tomcat/webappsThe -R makes chown apply recursively to all the contents of the directory.
The group will need write permission too:
sudo chmod g+w /opt/tomcat/webappsOr if you prefer octal :)
sudo chmod 770 /opt/tomcat/webapps 0