Why am I suddenly unable to write to this sshfs volume?

6,077
sshfs -o workaround=rename user@host:/var/www/html ~/sshfs/html

Sources:

Share:
6,077

Related videos on Youtube

dotVezz
Author by

dotVezz

Updated on September 18, 2022

Comments

  • dotVezz
    dotVezz almost 2 years

    There is a remote server which I connect to daily through ssh. I do a lot of editing of files on the server, so I use sshfs to do so.

    I mount the directory with $ sshfs user@host:/var/www/html ~/sshfs/html. This has worked very well over the past few months, and still should work even now. However, I'm having some strangely inconsistent access problems.

    Case 1 - Sublime Text: I'm completely unable to save anything using my editor of choice (Sublime Text). I can't Save-As to create a new file in ~/sshfs/html/ either. I can open files, but not save.

    Sublime gives the following message in an alert box when trying to save:

    screenshot

    Unable to save ~/sshfs/html/foo
    Error: rename(/home/ben/sshfs/html/.subl219.tmp, /home/ben/sshfs/html/foo) failed
    errno: 1
    

    Case 2 - Kate: I tried opening things in Kate to see if Sublime was just being dumb. I'm still unable to edit existing files, but I can create new files with no problems in Kate.

    Kate gives the following message in an alert box when trying to save an edit:

    screenshot

    The document could not be saved, as it was not possible to write to /home/ben/sshfs/html/foo.
    Check that you have write access to this file or that enough disk space is available.
    

    Case 3 - Vim: Here's where things start making less sense. I tried using Vim on my local machine with

    $ vim ~/sshfs/html/foo
    

    Surprisingly, I have no problems at all using Vim. It opens, edits, saves, and creates files without problems. I also have no problems when using shell commands such as touch.

    Things to consider

    • Group access
      • The group developers has access to all files I want to edit.
      • My local user is a member of the group developers.
      • My remote user (The account I login to via SSH) is a member of the group developers.
      • The group developers exists on both the server and my local machine with the same ID.
    • Other things
      • I have several directories across a couple of servers that I use like this. None of the other directories on other servers are giving me any trouble.
    • Running $ ls -l on my local host inside the mount point:

    Output

    drwxrwxr-x 1 root developers  4096 Sep  8 06:47 admin
    drwxrwxr-x 1 root developers  4096 Jun  4  2013 agent_submit
    -rwxrwxr-x 1 root developers  6605 Jun  4  2013 authorize.php
    
    • Running $ ls -l on the remote host through an ssh shell:

    Output

    drwxrwxr-x 10 root developers  4096 Sep  8 06:47 admin
    drwxrwxr-x  2 root developers  4096 Jun  4  2013 agent_submit
    -rwxrwxr-x  1 root developers  6605 Jun  4  2013 authorize.php
    
    • Levans
      Levans over 10 years
      What are the permissions of these files (output of ls -l) ? Can you edit files via shell commands, such as touch foo or echo "blah" >> foo ?
    • dotVezz
      dotVezz over 10 years
      @Levans: I've updated the question with ls output. And I have no problems editing or creating via shell commands.
    • rickhg12hs
      rickhg12hs over 10 years
      It shouldn't make any difference, but do you get the same behavior if you mount it like $ sshfs user@host:/var/www/html /home/ben/sshfs/html?
    • dotVezz
      dotVezz over 10 years
      @rickhg12hs no difference.
    • rickhg12hs
      rickhg12hs over 10 years
      Strange, but seems like it's probably fuse. Perhaps you could enable debugging and/or extend timeouts to see what's happening. sshfs man page has the switches to try.
  • MaQleod
    MaQleod about 10 years
    Even if accurate, posting just a command and links doesn't answer the question or help in the long run. It is best to explain what is wrong and why the command provided is the solution as well as explaining any pertinent portions of the provided links.