Editing files on server through SSH

14,605

Solution 1

If you already have ability to ssh onto that remote host then on local ubuntu machine issue

sudo apt-get install sshfs

mkdir ~/local_mountpointdir  # create empty local live mirror of remote dir

sshfs remoteuserid@remotehost:/path/remote_dir  ~/local_mountpointdir

You are free to use any local editor to do live edits on any file living on that remote dir /path/remote_dir by editing the same filename found on your new local live mirror directory ... still on local machine issue

cd  ~/local_mountpointdir
ls -la   # you will see all files listed which live on remote host

Now just edit any file in ~/local_mountpointdir which will live real time auto sync all edits up to remote host dir ... when done just kill the local box pid running sshfs at which point the connection will be gone and so will the contents of ~/local_mountpointdir knowing they are safe up on remote host ... killall sshfs

Solution 2

ssh into the server and run the following commands to install atom:

sudo apt-get update
sudo apt-get install gdebi xauth
wget https://atom.io/download/deb
mv deb atom.deb
sudo gdebi atom.deb
rm atom.deb

After installation, exit out of the ssh session.

Then, you can forward an xsession over ssh using the -X option like so:

ssh -X username@serverip atom

replacing username and serverip with the actual username and actual server ip of course.

Here are some related posts:

how-to-view-graphical-view-of-application-using-ssh

how-to-forward-x-over-ssh-from-ubuntu-machine

Also, here is a related article.

Solution 3

You could use emacs as well. It has a wide range of features and a NoX mode

emacs -nw <filename>

Though the question is still, what functions are you looking for?

Solution 4

gEdit can do what you want. You can set your system up to connect to a remote server through Nautilus (files, connect to server). You can then use the left pane (F9) in gEdit to browse to this remote server and start editing away.

I use Aptana for things like that. It has a "remote ftp" method where you create a connection, point to a directory and it lists all the files so you can edit them. For html, js and other coding languages an IDE like Aptana has code formatting. Oh and don't discard vim so easily ;) Eclipse, Bluefish, Anjuta, Geany are some other EDI's but I did not check the all for remote access ;)

You might need to change permissions on the files you want to be able to edit on the server side though.

Share:
14,605

Related videos on Youtube

IneptusMechanicus
Author by

IneptusMechanicus

Updated on September 18, 2022

Comments

  • IneptusMechanicus
    IneptusMechanicus over 1 year

    I'm working on a web application and all of it's files are on a linux server, which I am accessing through SSH. Is there a way to edit these files in a text editor other than vim or nano through SSH, because there is a whole team of us that has to work on this project (front-end, DB management etc.), and we prefer working on it while it's on the server. I'm talking about editing files over SSH on text editors along the line of Sublime Text or Atom.

  • Mostafa Ahangarha
    Mostafa Ahangarha about 8 years
    How can he use emacs to work on file through SSH? Explain this
  • Jim Knopf
    Jim Knopf over 7 years
    Ether login over ssh and use the NoX mode, if emacs is installed remotely or open the file in emacs using: C-x C-f /ssh:user@host:/path/to/file