Permission denied in FTP even though I'm the owner
Okay, so I've tried my best at finding the answer to this by searching and looking through possible duplicates, but I just can't so forgive me if it's out there somewhere anyways.
My issue is as follows. I've set the owner of /var/www
to myuser:www-data
and permissions of the folder and all (currently just the basic index.html) it's content to 750
, and Apache seems to run it as supposed, but I can't access it when I FTP into the server as the myuser
user. I mean, I can access it, but as soon as I try to edit, delete or add something I just get 500 Permission denied
, and if I try to edit the permissions I get 500 Unknown SITE command
.
Help! What do I do wrong? The idea on setting the user and group, and then the permissions as above was from a good friend of mine who is sort of an expert, but I feel like I'm bothering him when I ask so many questions, so if you can help me some more, that would be great!
I'm trying to put a backup with 4 vhosts back into the www-folder, but what I put there shouldn't be of any concern, right? That's just the confing of the vhosting later that has got anything to do with that, right?
Thanks in advance!
Added info:
I ran this:
myuser@myserver:/$ groups myuser
And got this:
myuser : myuser adm cdrom sudo dip plugdev lpadmin sambashare
Then I ran this:
myuser@myserver:/$ groups www-data
And got this:
www-data : www-data
And then this:
myuser@myserver:/var/www$ ls -l
And got this:
total 4
-rwxr-x--- 1 tjita1 www-data 177 Jan 25 17:45 index.html
Regarding the ftpserver, I didn't do anything in particular, I just installed vsftpd. Oh yeah, I also added a line in I think /etc/vsftpd.conf
or something like that, that reads something like this: chmod_enable=YES
.
Also, I can't get those 4-space-indents to work, sorry about that..
Solution 1:
After you install the ftp server with sudo apt-get install vsftpd
you will have to configure it. To enable write access you have to edit the /etc/vsftpd.conf
file and uncomment the
#write_enable=YES
line, so it should read
write_enable=YES
Save the file and restart vsftpd
with sudo service vsftpd restart
.
For other configuration options consult this documentation or man vsftpd.conf
Solution 2:
A simple way I found to use ftp with curl command here. If you wanna use ftp with a single command than use the following command
sudo curl -T file_to_be_uploaded.txt ftp://mydomain.com/mydirectory/ --user username:password
If you get an error 551: permission denied
than run it the file you are uploading might be present on the remote and you don't have permission to overwrite it. So upload it with a different file name or delete the current file on the remote.
Solution 3:
I had the same problem & none of the suggestions about Write_enable or folder permissions worked. I changed my connection type in my FTP client from FTP to SSH/SFTP, and everything worked fine. Apparently, VSFTPD requires a secure connection to write.
Solution 4:
Run below command - which folder you require files to upload
sudo chown -R <>:root <> example
sudo chown -R myloginid:root /home/myproject