Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to make changes to my website over ftp but when I save any files it changes the permissions and owner to my username. I can edit files in the same folder trough samba without changing the permissions. I really don't understand how the permissions for the /var/www folder work and I'm pulling my hair out trying to get it to work. I have recently made changes to the permissions of the /var/www directory (following this guide) so I could modify files in the www root. Right now I have the entire contents of /var/www set as -rwxrwxr-x 1 www-data www-data but when I change a file over ftp it becomes -rw------- 1 akbkuku akbkuku, akbkuku being my username. I am using vsftpd as the server, and I login with my normal user.

How do I make it leave to permissions alone?

At this point I'll even take a way yo reset all the permission back to stock and I'll just never modify files in the web root.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

The settings depend on which FTP client you are using. Also to some extent the FTP server you are connecting to.

Usually, from the ftp command line,you can

  1. set your umask for the session, or
  2. change the permissions on files/directories that you own.

If you want to be sure that the website sees your files, make sure they are WORLD readable (and directories have RX bits set).

share|improve this answer
    
I think it was my client. I was using ftpuse to mount the server as a remote drive in windows. I now know that windows 7 does it natively. I tried using winscp so I could get to the web directory and when I had modified files it didn't change the permissions, thank you! –  AkBKukU Dec 7 '12 at 1:12
add comment

It might be a vsftpd configuration issue. If you're getting -rw-------, maybe the option file_open_mode is set to 0600 or local_umask to 060. From man vsftpd.conf:

file_open_mode

The permissions with which uploaded files are created. Umasks are applied on top of this value. You may wish to change to 0777 if you want uploaded files to be executable.

Default: 0666

local_umask

The value that the umask for file creation is set to for local users.

Default: 077

If you want -rw-rw-r--, you could try changin one or both options in /etc/vsftpd.conf: file_open_mode=0660, local_umask=066.

Bear in mind that this change is server-wide. All uploaded files, even outside /var/www if it's not the only accesible directory, will get 660 permission, which might not be what you want.

share|improve this answer
    
I found the local_umask setting and made the change but it didn't fix it. I also saw the chown_uploads setting and tried that but it didn't work. I tried changing the client like mentioned in the post above and it no longer changed the permission. I don't know if the setting changed how the new client worked but it does now, thank you! –  AkBKukU Dec 7 '12 at 1:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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