Alternative to SSH command line from Ubuntu

14

2

We have a machine at work that's running CentOS. In order to get into it, I use ssh.

We're not allowed to install any window-management systems on it. Sometimes, I need to do a lot of work on it, such as editing configs, checking multiple logs, etc. All this becomes a bit tedious working on the command line (forgive me I'm not a command line ninja).

I've just been having multiple sessions going in order to have all the logs and files I need up but is there someway I could "see" the remote machine's file system on my local machine, so that I could open and edit the remote machines files on my local machine that has all my nice windows and text editors available on it?

ThrowsException

Posted 2014-08-08T19:29:23.383

Reputation: 263

Hi there, sorry I misinterpreted your question. Thank you for clarifying the title for us. – Canadian Luke – 2014-08-08T20:09:14.337

1No problem. Should have added that in first place. – ThrowsException – 2014-08-08T20:15:17.203

1

Have you looked into terminal multiplexing software? Screen and tmux allow you to have multiple sessions open simultaneously, and provide a pseudo-windowed interface over a pure ssh session. Plus, it's almost guaranteed that your CentOS box even already has at least screen on it.

– Fake Name – 2014-08-09T11:31:33.433

1Does X-forwarding count as a window management system? – user253751 – 2014-08-09T23:16:46.483

Answers

28

Look into installing sshfs if you're on Linux. You can remotely connect to a machine over ssh, but it will show it as part of the file system on your local machine, so you can edit files in your local editor, and treat it as if it were a local file. You don't even have to install anything on the server side, it all just works off of ssh.

Similarly, there is win-sshfs for windows, which takes a similar approach to sshfs, but instead mounts the file system as a Windows network drive. Thanks for the recommendation Lexi R!

Another alternative would be using FTP to grab the files and put them onto your local machine, view and edit them as you'd like, then use FTP to put them back in place. You'd need a FTP server on the CentOS box, and you can use something like Filezilla to connect.

Adam

Posted 2014-08-08T19:29:23.383

Reputation: 1 510

2sshfs is not an alternative if he's using Windows. In that case WinSCP would be a better fit. – Marcelo – 2014-08-08T20:08:20.250

2sshfs was exactly what I was looking for. That is boss. – ThrowsException – 2014-08-08T20:15:50.347

1FileZilla has built-in support for SFTP, which (confusingly) has nothing to do with FTP but everything to do with SSH. On a normal server, if you can SSH to it, you can probably SFTP with the same credentials, and no FTP server needs to be installed. (WinSCP uses the same protocol, so either both will work or neither.) – IMSoP – 2014-08-09T22:23:13.690

2

@Marcelo win-sshfs is available, my roommate swears by(and at) it.

– Lex R – 2014-08-20T20:06:56.010

7

If you are running the connection from Windows, you can check out WinSCP. It is free, and gives you a tree-view (Explorer-like) of the file system that you have access to.

If you are running from a *nix environment, you'll need to enable some sort of file access to it, such as FTP (insecure), SFTP (secure), or you can mount the remote filesystem as a CIFS, NFS or sshfs file system. All these options are free, and should be built in to your OS.

Canadian Luke

Posted 2014-08-08T19:29:23.383

Reputation: 22 162

4

Current Linux desktops often have some kind of sshfs built-in. Eg. in Gnome, open the file manager (Nautilus), press Ctrl+L to get an editable location bar, and enter an URL like sftp://example.com/ and press Enter. This will open an SSH (actually SFTP) connection to example.com and present its contents in the file manager, and you can browse it like any local directory.

Once you have established the connection, you can also access the remote directory from non-Gnome applications (eg. KDE apps, or even from command line). Easiest way is probably to drag the directories from file manager into the target application or into the shell. With some experience you can also navigate to the remote directory manually: they are usually mounted under ~/.gvfs/ or under /run/user/<userid>/gvfs/.

KDE appears to have a similar mechanism as well.

I have no experience with sshfs, but I guess sshfs and the Gnome-builtin SFTP access (GVFS) offer similar features. Personally I like GVFS for it's ease of use, and also appreciate that it's quite universally available nowadays without installing additional software or setting anything up.

oliver

Posted 2014-08-08T19:29:23.383

Reputation: 430

That's what I do under similar circumstances. To make a permanent connection (in Gnome), go to "Places" and choose "Connect to Server". – jaia – 2014-08-09T20:28:10.553

1

In Notepad++, the NppFTP Plugin supports SCP. I use it all the time to edit files remotely. Navigate in the NppFTP tab, double click a file to download it to a temp directory, and it's uploaded when you save the file.

GreyFairer

Posted 2014-08-08T19:29:23.383

Reputation: 111

0

Use a configuration management tool (like puppet or ansible). In this way you can keep your configuration files locally and can use your local tooling. As a nice "side" effect (which is probably even more important) you can get the configuration version controlled, automatically deployed and easily reproduced (also for additional servers).

David Ongaro

Posted 2014-08-08T19:29:23.383

Reputation: 226

0

I think NFS may be better solution if the client machine (From where you are editing the files). Share the files via NFS and mount them in client machine. It will appear as a local drive. You can use any of your favorite GUI editors to edit the files.

Chandrasekar

Posted 2014-08-08T19:29:23.383

Reputation: 221