Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

What's an easy way to be able to edit remote files such as bash scripts? Currently I'm using Vim on the server, but that's obviously not ideal, particularly when lag is noticeable.

On Windows, I'd probably use WinSCP. I'm newish to Mac so could be missing something obvious.

I have SSH and SFTP access to the machine, but no root on it. Using Finder's "connect to remote server" (sftp://my.server.com) didn't work - just spins and doesn't connect. But sftp from command line is fine.

share|improve this question
    
(oic, SFTP != FTPS) –  Steve Bennett Jan 11 '12 at 5:01
add comment

5 Answers

up vote 1 down vote accepted

You could use MacFuse and the SSH FS to mount the remote path into a local mount point and edit it with the local editor of your choice.

share|improve this answer
    
Incredibly, this worked. I say "incredibly" because MacFuse is no longer supported, and the SSHFS binaries stop at Leopard (I'm running Snow Leopard). But I just installed MacFUse then ran the SSHFS leopard binary, and 5 minutes later the remote drive is mounted locally! Wow. Thanks! :) –  Steve Bennett Jan 16 '12 at 5:21
    
FYI trying this with OS X 10.8.2 running my text editor (Sublime Text 2) and a remote Ubuntu 12.04 server holding the code in a git repository, there seems to be all manner of havoc happening with files that are not changed showing as changed, empty files showing up, etc. Too flaky sadly to rely upon. Going to try Sublime SFTP next. –  Peter Lyons Nov 2 '12 at 18:01
add comment

MACOSX finder does not support sftp yet.

If you enjoy command line option,you can use local vim or vi to edit remote file easily with

vim scp://remoteuser@server.tld//path/to/document

If you are fan of gui based editor, you can try TextWrangler. It can load and save file over sftp.

share|improve this answer
    
Yeah, syntax highlighting and copy-paste are big advantages over vim. –  Steve Bennett Jan 16 '12 at 5:23
add comment

I would recommend using Cyberduck for SFTP and Sublime Text 2 Editor. I use this combo on my Mac daily. Bonus is both programs work on Windows too.

share|improve this answer
add comment

Ok, this script seems to fill my needs:

SERVER=my.hardcoded.server.name
EDITOR="/Applications/TextMate 2.app"
if [ -e /tmp/$1 ]; then
  echo "/tmp/$1 already exists - exiting."
  exit;
fi
scp $SERVER:$1 /tmp/$1 || exit
open -W -a "$EDITOR" /tmp/$1
scp /tmp/$1 $SERVER:$1 && rm /tmp/$1
share|improve this answer
add comment

I can't add another link to my previous answer.

Update: more discussions on SFTP / remote editing at http://news.ycombinator.com/item?id=3455360 using Sublime Text. Might be of value to you also.

share|improve this answer
1  
The easiest way is probably to use this package: wbond.net/sublime_packages/sftp –  Dan Dascalescu Oct 14 '12 at 0:19
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.