Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using a fresh installation of CENTOS 6.2, when I connect to the server ( SFTP mount with nautilus ) and edit files, no matter what permission the file had before, it is reset to 700, read+write+execute only for the owner. When SSHing directly into the machine and editing files on the command line - no permissions are changed.

The files I am editing are website scripts sitting in my Apache folders.

Why is this behavior happening? Any suggestions are welcome.

share|improve this question

What are you using to "edit" the files while SFTP-mounted?

If it's a GUI app, it might be creating a new file, deleting the old one, and renaming the new one to match the old, instead of just "editing" the existing one.

If this is the case, the new file would be created with the default mask.

share|improve this answer
Im using graphical vi, but I observed the same behavior when editing with vi from the command line. – Lix Dec 29 '11 at 7:33
up vote 0 down vote accepted

Solution I found was to use SSHFS and set the umask as an SSH option.

sshfs -o umask=0133 root@remote_machine_address:/ /desired_mount_point

Setting the umask in /etc/profile and the ssh config files had no affect when mounting SFTP with nautilus.

share|improve this answer
Getting sftp-server to obey a umask is extremely difficult. The only way I've ever gotten it to work is via an ugly hack, like this:… – Keith Dec 28 '11 at 22:59
sshfs seems to obey the umask I pass it. My problem with sshfs is that it does not handle connection drops at all. I have an unstable internet connection and it disconnects and reconnects quite often - when using a browser these drops are not an issue because a simple refresh after a few seconds will let me continue browsing. Files that were mounted with sshfs however, are unaccessible, I am unable to unmount the volume and my file browser (nautilus) becomes interrubtable. – Lix Dec 29 '11 at 7:37

Your Answer


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.