7

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.

7 Answers 7

5

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

3

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.

2

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?

2
  • How can he use emacs to work on file through SSH? Explain this Mar 23, 2016 at 8:15
  • 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
    – Jim Knopf
    Oct 25, 2016 at 10:43
1

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.

0

If you start your ssh session with the -X option you can use any installed editor, man -k editor | less to see what your system has. The -X option will set up X11 forwarding back to you. See man ssh.

What features of "Sublime Text or Atom" are you looking for?

1
  • I just find it inconvenient to write front-end in a terminal text editor, I'm used to using Sublime text when writing html/css/javascript, even php, i just don't like them, which is why I'm looking for a way to edit them in a GUI-based editor instead Mar 22, 2016 at 18:45
0

I agree with what a few people have mentioned about forwarding GUI apps over SSH. I tend to do that with a few things we run e.g. On our IBM TSM server. I've never used the editors you've mentioned but I think forwarding it over X is the way to go if your wanting to use SSH.

0

I know what you mean. Vim is a very powerful tool, but nearly no-one "knows" how to use it.

I actually prefer mcedit (the editor packaged with mc - Midnight Commander) which I tend to install for SSH connections anyway.

If you want to use a graphical editor you could install a X server to share GUI over SSH as some other answers suggest. But IMO that's overkill and a lot of extra stuff on your server. I would rather suggest you share the folders containing the pages to be worked on, preferably over NFS as it would be the least extra installs, or even just WebDAV seeing as your server is already running a web serving daemon. Though if your client computers are running Windows you'd need samba instead, just ensure you NEVER allow Samba to share outside your local LAN - [sarcasm=on]it's not the most secure thing to do[/sarcasm].

If you need full access to all folders on the server I would suggest SFTP over your SSH connection. It's also already on your server as you've got SSH up and running already - no extra installs needed on your server which is a BIG plus. It's even possible to mount a SFTP as a network "drive", at least natively in all Linuxes (as one answer suggests through sshfs). For Windows it requires something like Swish installed (or perhaps Dokan SSHFS).

Though for content on a web server I would definitely suggest you look at some form of CMS (especially if more than one person is to edit stuff). Best would actually be a versioning system, probably Git or SVN. They should be rather simple to install on your web server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .