I use the command, to mount my remote filesystem using SSHFS:

$ sshfs -o uid=1000 -o gid=1000 root@ "/home/chendy/my_mount"

Everything seems to be happy, unless I try and open and save a file with Sublime...

View and rename files? YES:

... I can view my files in the file explorer, and I can successfully rename files using the file explorer.

Permissions/Users/Groups? YES

... When checking permissions, everything seems in order:

$ ls -l '/home/chendy/my_mount/home/kano/test.py'
-rwxrwxrwx 1 chendy chendy 927 Apr 15 16:24

Edit file with VIM? YES

... I can also open the file with VIM and save it.

Edit file with Sublime? ERROR

... But when I open the file in Sublime (Sublime Text 3 Build 3059) by loading it through the file explorer, or using the command line:

 $ /opt/sublime_text/sublime_text '/home/chendy/my_mount/home/kano/test.py'

I get the same error:

Unable to save ~/my_mount/home/kano/test.py Error: rename(/home/chendy/my_mount/home/kano/.subl979.tmp, /home/chendy/my_mount/home/kano/test.py) failed: Operation not permitted

What's going on? Is there any way to solve?

  • 1
    try using touch /home/chendy/my_mount/home/kano/.subl979.tmp. – Braiam Apr 16 '14 at 14:25

Like many editors, Sublime saves to a temporary file, then moves that temporary file into place. It's done this way in case the system crashes during the save: it's guaranteed that either the original file or the new version will be present, you don't risk losing the file.

SSHFS is built on top of SFTP, which (at least as implemented by OpenSSH) does not allow renaming a file and atomically overwriting the target. (This is mentioned in the SSHFS FAQ.)

You can work around this limitation by telling SSHFS to allow rename-and-overwrite, but making the operation non-atomic (so there is a very small time during which the old file is removed but the new file still has its temporary name). This is a problem for some use cases but not when just editing a file.

Add the option -o workaround=rename to your sshfs command line.


Short answer, set this setting in your config:

"atomic_save": false

It will avoid renaming over sshfs (SFTP), which is not supported.

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.