Amazon Ec2 FTP Write Permission
The ec2-user don't have permission to write files in /var/lib/tomcat6/webapps/. Only root user can do so. You have two ways here to do so:
1) Copy files to /home/ec2-user/ using filezilla. Now SSH into linux machine through putty. Change to root user using command sudo -s
. Then copy file from /home/ec2-user to /var/lib/tomcat6/webapps/ using command cp -i RealEstateERP.war /var/lib/tomcat6/webapps/
.
2) SSH into linux machine through putty.Change to root user using command sudo -s
.Provide write permission to all users on /var/lib/tomcat6/webapps/ using command chmod 777 /var/lib/tomcat6/webapps/
. Then copy files to directory directly from filezilla.
Amazon AWS Filezilla transfer permission denied
To allow user ec2-user
(Amazon AWS) write access to the public web directory (/var/www/html),
enter this command via Putty or Terminal, as the root user sudo
:
sudo chown -R ec2-user /var/www/html
Make sure permissions on that entire folder were correct:
sudo chmod -R 755 /var/www/html
Doc's:
Setting up amazon ec2-instances
Connect to Amazon EC2 file directory using Filezilla and SFTP (Video)
Understanding and Using File Permissions
AWS EC2 FTP Permission Denied
This is a permission issue. Use this command.
sudo rm var/www/info.php
Giving write permission back to Wordpress on AWS EC2 via PuTTY
Fixed:
I wound up adding
echo(exec("whoami"));die();
to the top of my WordPress index.php file to figure out the user. Make sure to remove it once you're done.
Lets say my username wound up being "foo".
After I had the username, I went back into PuTTY, and ran
sudo chown -R foo /var/app
and can now modify files through wordpress again.
EC2 user permissions
This is a pure Linux permission problem, not an AWS problem.
I just created an Amazon Linux instance and verified permissions in /var
[ec2-user@ip-1-1-1-174 ~]$ ls -ald /var/www
drwxr-xr-x 7 root root 4096 Oct 22 23:34 /var/www
As you see, ownership is root
and not ec2-user
. You should understand first what / why you see permission on /var/www/
to ec2-user
Should need to change the owner of that directory again, you can type :
chown -R root:root /var/www
It is not a best practice to let your web server (httpd
) write to /var/www
nor to run that process with elevated privileges (such as root).
Should your app really write to the local storage, use a different volume, mounted in a separate directory, where no executable are available.
How can I use Filezilla and vsftpd to write to an AWS EC2 instance of Ubuntu 14.04?
If you want to be able to modify files in your web directories, try changing the ownership (instead of the mode) by doing this:
sudo chown -R $USER:$USER /var/www/html
The $USER variable will take the value of the user you are currently logged in as.
By doing this, your regular (non root) user now owns the html subdirectories where you are trying to move files into.
It probably a good idea to also modify permissions a little bit to ensure that read access is permitted to the general web directory and all of the files and folders it contains so that pages can be served correctly, use:
sudo chmod -R 755 /var/www
Your web server should now have the permissions it needs to serve content, and your user should be able to create content within the necessary folders
Related Topics
Tomcat Doesn't Stop. How to Debug This
Couldn't Install Netbeans 11.3 with Java 14 Due to Error: "Unsupported Jvm Version"
Why This Javac: File Not Found Error
How to Check If a File Is Open by Another Process (Java/Linux)
Setting/Changing the Ctime or "Change Time" Attribute on a File
Obtaining the Thread Id for Java Threads in Linux
Could Not Reserve Enough Space for Object Heap to Start Jvm
Noclassdeffounderror: Android.Support.V7.Internal.View.Menu.Menubuilder
Android Load from Url to Bitmap
How to Delete Firebase Data After "N" Days
Android: Difference Between Onintercepttouchevent and Dispatchtouchevent
How to Make This Jbutton Visible? When I Have Progressive Scan Background Jwindow()
Getting Unwanted Characters When Reading Command Output from Ssh Server Using Jsch
How to Find a Java Thread Running on Linux with Ps -Axl