Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (12.9k points)

I am able to successfully connect to amazon ec2 instance using filezilla. The Username i used is ec2-user. So when i try to transfer my application war to tomcat it says

/var/lib/tomcat6/webapps/RealEstateERP.war: open for write: permission denied

 Error: File transfer failed.

I tried to change permission use filezilla but not allowed to do so. I know there is no write permission, but how do i change it.

I ma new to linux. Please help me.

1 Answer

0 votes
by (18.2k points)

Only the root user has the permission to write files in /var/lib/tomcat6/webapps/. So, if you try to do it using ec2-user, it will give an error, like the one in your case. 

What you can do is:

Method 1:

a) Copy the files to /home/ec2-user/. You can use filezilla for that. Then SSH into your linux instance using putty. Change the user using sudo -s command.

b) Now copy file from /home/ec2-user to /var/lib/tomcat6/webapps/  using the following command:

cp -i RealEstateERP.war  /var/lib/tomcat6/webapps/

Method 2: 

You can also directly SSH into your instance, change root user using the same sudo -s command and then provide write permission to all users on /var/lib/tomcat6/webapps/ using the following command:

chmod 777 /var/lib/tomcat6/webapps/

Note: This second method is not recommended but it does work.

Related questions

0 votes
1 answer

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer
asked Jul 12, 2019 in AWS by Amyra (12.9k points)
0 votes
1 answer

Browse Categories