7

I'm using Ubuntu 14.04 and vsftpd. In the past my account (not root) has had full access, more or less, to either FTP or SFTP to anything on my server and edit any file that my user account could edit. Now, recently, I cannot edit anything, only view. As a specific example, I cannot upload to /var/www even though my user is a member of the www-data group and that group owns the files (file/folder permissions are correct).

I'm not terribly familiar with vsftpd and how it works. I mainly need to be able to FTP or SFTP to my /var/www directory to edit my website. What could be my problem?

EDIT: The specific error message when using FTP is 553 Could not create file.

  • If your using SFTP, doesn't that use SSH (openssh-server) not FTP (vsftpd) - is SSH set up on the machine? Edit: Di any error messages result? Quite a few FTP/SFTP clients have a bit where it tells you what it is doing. – Wilf Jun 28 '14 at 19:59
  • I have the problem whether I'm using FTP or SFTP. Just edited the OP to clarify. That seems to me to indicate a file permissions problem, but I can't see how that would be the case, considering my www-data example in the OP. – vaindil Jun 28 '14 at 20:01
  • also, what is the output of ls -l /var/www, as by default it cannot be changed by normal users. – Wilf Jun 28 '14 at 20:04
  • drwxrwxr-x 2 www-data root 4096 Jun 27 23:50 html – vaindil Jun 28 '14 at 20:05
16

You should be able to change the permissions (by terminal on the machine or over SSH) by running this so that users other than root can access it:

sudo chmod -R 757 /var/www

or this so that it is owned by your user (which should be defined by $USER):

sudo chown -R $USER:$USER /var/www

You need to do this as only the owner+group can read, write and execute in /var/www, but other users can only read and execute - including the user you are using to try and the folders.

For more info, look at man chmod and man chown

  • I had tried chmodding with no resolution, but for some reason doing it now fixed the problem. Thank you for this simple answer, I appreciate it! – vaindil Jun 28 '14 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.