title: Tomcat on EC2. Can't write to webapps
body: <p>End game: Copy project directory to tomcat webapps directory hosted on ec2.</p>
  
  <p>I have an amazon linux instance, I install tomcat via</p>
  
  <pre><code>sudo yum install tomcat7-webapps
  </code></pre>
  
  <p>When I first ssh in I am led to a home folder. From there I must cd twice, then proceed to</p>
  
  <pre><code>/var/lib/tomcat7/webapps
  </code></pre>
  
  <p>I tried to transfer the directory using filezilla, but I don't have write permissions here.. also attempted to change the permissions but it's not allowed. Should I have installed tomcat to my home directory perhaps?</p>
  
  <p>I also tried to set up a repository with git but running git init failed as it couldn't write.</p>
  
  <p>Read about scp, could I use that to transfer the entire directory?</p>
  
  <p>Any help here is much appreciated! I read a ton of older posts but nothings working for me.</p>
  
  <ul>
  <li>importing pem to filezilla, set up as sftp user:ec2-user</li>
  </ul>
  
  <p><strong>EDIT: I have sorted it out! My solution:</strong></p>
  
  <p>Find where tomcat was installed, in my case</p>
  
  <pre><code>/var/lib/tomcat7
  </code></pre>
  
  <p>and run the following:</p>
  
  <pre><code>sudo usermod -a -G tomcat7 ec2-user
  sudo chmod -R g+w /var/lib/tomcat7
  </code></pre>
  
  <p>I found this question being asked a ton, so I hope this helps anyone with this problem in the future! Give this guy a vote if it helps. <a href="https://stackoverflow.com/questions/12020622/how-to-upload-a-lib-for-tomcat-in-amazon-ec2">Solution</a></p>