How to upload a lib for Tomcat in Amazon EC2

0 votes

I want to upload a lib to my Tomcat folder (in an EC2 instance). What i have done is:

scp -r -i /home/path_to_key/key.pem /home/path_to_file/file.jar

This works perfectly only if I upload files in the "user" folder. But when i try to to upload a file in /opt/tomcat7/lib/ ? I receive this error:

scp: /opt/tomcat7/lib/file.jar: Permission denied

Any suggestions as to what i should do?

Aug 20, 2018 in AWS by datageek
• 2,530 points

1 answer to this question.

0 votes

You need to set the proper privileges so that the ec2-user can write to the target directory. Try executing these two commands:


sudo ls -al /opt/tomcat7

Based on the error that you are getting i think the proper thing to do would be to add the ec2-user to the "tomcat7" group, then grant that group write access to the directory:

sudo usermod -a -G tomcat7 ec2-user sudo chmod -R g+w /opt/tomcat7

answered Aug 20, 2018 by Archana
• 4,150 points

Related Questions In AWS

0 votes
3 answers
0 votes
1 answer

In Amazon Data Pipeline, how to make sure only once instance of a pipeline is running at any time?

On the CopyTablesActivity, you could set a lateAfterTimeout attribute ...READ MORE

answered Sep 19, 2018 in AWS by Priyaj
• 58,120 points
0 votes
1 answer

How to upload an object into Amazon S3 in Lambda?

I suspect you are calling the context.done() function before s3.upload() has ...READ MORE

answered Sep 27, 2018 in AWS by Archana
• 4,150 points
0 votes
1 answer

How to restore a cluster from backup in Amazon Redshift

Amazon Redshift replicates all your data within ...READ MORE

answered Sep 28, 2018 in AWS by Archana
• 4,150 points
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
+2 votes
1 answer
0 votes
1 answer

How to upload a file to Amazon S3 without passing it my server?

This article pretty much explains the entire ...READ MORE

answered Aug 14, 2018 in AWS by Archana
• 4,150 points
0 votes
1 answer

How to set up a SPF(Sender Policy Framework) for AWS EC2 instance?

Setting up a SPF record is pretty ...READ MORE

answered Aug 16, 2018 in AWS by Archana
• 4,150 points