# SSH editing files on the server.



## valsorym (Nov 19, 2011)

Hia all,
I have a remote server (accessed by SSH). 
All is well. I connect via SSH run the editors/vim, and I correct all that is needed.
But here's the rub.
For a long time so you can not work. Not convenient.

I would like something like this:
`# geany -p PORT [email]root@mysite.com:/usr/local/www/mysite.com[/email]/cgi-bin/index.c`
I would like to work in devel/geany on my computer, and while maintaining the record to the server.

Do not know how to do so?

Then I decided to install sysutils/fusefs-sshfs.
Method is not as good as the one I described earlier, but even so....

```
# mkdir -p ~/sshmnt
# sshfs -C -p PORT root@mysite.com:/usr/local/www/mysite.com/cgi-bin/ ~/sshmnt
fuse: failed to open fuse device: No such file or directory
```

But the file is there, I just checked the 

And as you're struggling with such issues?


----------



## jrm@ (Nov 20, 2011)

Does `% kldstat` show the fuse module (sysutils/fusefs-kmod) loaded?  If not, `# /usr/local/etc/rc.d/fusefs start` to load it.


----------



## valsorym (Nov 20, 2011)

Oh, thanks for the idea.
It was all just a little wrong.


```
# echo 'fusefs_enable="YES"' >> /etc/rc.conf
# /usr/local/etc/rc.d/fusefs start
Starting fusefs. 

# sshfs -C -p PORT root@mysite.com:/usr/local/www/mysite.com/cgi-bin/ ~/sshmnt
... ready!
```

Thank you very much!


----------



## valsorym (Nov 20, 2011)

*Problems.......*

Damn.
Now making

```
# cd ~/sshmnt
# geany index.c
```

- All good ... but after I pressed "Ctrl + S" - my computer reboot. x(
_The last 10 minutes of recovering a system with fsck._

what? why?
This is just me?


----------



## valsorym (Nov 20, 2011)

I found a decent solution.
`vim [url=scp://root@mysite.com:PORT//usr/local/www/mysite.com/cgi-bin/index.c]scp://root@mysite.com:PORT//usr/local/w ... in/index.c[/url]`

I love editors/vim - all is well. One drawback:
1. Each time I save / open file I should enter  password - annoying.

But it's better than what  edit via console-ssh (not braking when entering characters).

If someone else has other suggestions - I will listen to them. Thank you!


----------



## jrm@ (Nov 20, 2011)

You can authenticate without using a password: http://forums.freebsd.org/showthread.php?t=1508.

Running the local vi(m) (on mysite.com) is a common way to do things.  I'll leave it to the vi(m) users to help you figure out why the characters are messed up.


----------



## jrm@ (Nov 20, 2011)

doorways said:
			
		

> Damn.
> Now making
> 
> ```
> ...



I've used sshfs from time to time and I don't recall any stability issues.

You can use gjournal() to (almost) eliminate the need for fsck.  See also: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/geom-gjournal.html.


----------



## valsorym (Nov 20, 2011)

Thank you jrm!


----------



## mix_room (Nov 22, 2011)

doorways said:
			
		

> I found a decent solution.
> `vim [url=scp://root@mysite.com:PORT//usr/local/www/mysite.com/cgi-bin/index.c]scp://root@mysite.com:PORT//usr/local/w ... in/index.c[/url]`



I would suggest not running as root.


----------



## valsorym (Nov 22, 2011)

> Originally Posted by *mix_room*.
> I would suggest not running as root.


I know, thank you! It is test moment! But thank you!


----------



## cuq (Jan 29, 2012)

Hi, I had found a workaround to this behavior in geany in a blog. It works for me now:
1. In  ~/.config/geany/geany.conf I've changed the value of use_gio_unsafe_file_saving to false and add other parameter not present; in short the two modified parameters are:


```
use_gio_unsafe_file_saving=false
use_safe_file_saving=true
```

2. To connect to the server I am using now:

```
sshfs -o workaround=rename  user@server:/path /path_to/mount_point
```

And that's it! I can use geany with sshfs now!

cheers
cuq


----------



## valsorym (Feb 4, 2012)

Thanks!


----------

