32

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..

2
  • I don't know whether this is right, but messing with permissions of such a directory is not a good way. Anyhow, May I ask the output of groups myuser (as in; replace it with the username of the user) please? and also ls -l of www dir
    – AzkerM
    Jan 26, 2014 at 12:03
  • 1
    How did you setup your ftp server?
    – falconer
    Jan 26, 2014 at 12:12

4 Answers 4

50

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

3
  • 3
    You are the man. This finally helped me! Aug 30, 2014 at 16:46
  • And all the answers on the internet were wrong. Yet, so simple and plain. I even read teh vsftpd.conf just for fun!
    – M J
    Jul 8, 2017 at 3:17
  • 1
    Notice: after this make sure to kill current vsftpd process. Then restart it via sudo service vsftpd start to make it pick-up these new changes. Now, you will be able to connect via FTP and write/delete files.
    – Kari
    Mar 31, 2020 at 2:28
5

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.

1

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.

1
  • 3
    If you used SFTP, then you're likely not using vsftpd, despite the name. FTPS is secure FTP, SFTP is the SSH File Transfer Protocol, and is usually handled by whichever SSH server is installed.
    – muru
    May 21, 2015 at 5:13
1

Run below command - which folder you require files to upload

sudo chown -R <>:root <> example

sudo chown -R myloginid:root /home/myproject

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .