2

I have a folder named "webapps" with the following permissions:

$ ls -al /opt/tomcat
$ drwxr-x--- 7 tomcat root    4096 Aug 15 22:06 webapps

I have a user which is part of the "tomcat" group:

$ groups
$ hamburgers sudo tomcat

When 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 denied

I 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

5

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/webapps

The -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/webapps

Or if you prefer octal :)

sudo chmod 770 /opt/tomcat/webapps
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.