This is a mirror of official site: http://jasper-net.blogspot.com/

SSH Can Do That? Productivity Tips for Working with Remote Servers

| Sunday, August 21, 2011
SSH has many features which are helpful when working regularly with files on remote servers; together they can give a vast increase in productivity over the bare use of SSH. If you regularly use SSH, it’s worth spending a little time learning about these and configuring your environment to make your life easier.

This was presented at Yapc Europe 2011 in Riga. If you’d like me to come and talk about this at your user group or workplace, please get in touch.


Multiple Connections

Often it’s useful to have multiple connections to the same server, for example to edit a file, run some file-system commands, and view a log file all in different terminal windows. Except sometimes that can seem too much hassle, so we compromise and end up repeatedly cycling through quitting and restarting a few different commands in one window.

Fortunately OpenSSH has a feature which makes it much snappier to get another terminal on a server you’re already connected to: connection sharing. OpenSSH is the implementation of SSH that comes with many Unix-liked operating systems, including all the common Linux distributions and Mac OSX.

To enable connection sharing, edit (or create) your personal SSH config, which is stored in the file ~/.ssh/config, and add these lines:

ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r

Then exit any existing SSH connections, and make a new connection to a server. Now in a second window, SSH to that same server. The second terminal prompt should appear almost instantaneously, and if you were prompted for a password on the first connection (which we need to sort out anyway ‒ keep reading ‒ but it's a convenient way of verifying this shared connection stuff) you won’t be on the second.


What About Windows Users?
Some of these productivity features are implementation-specific, so not available if you use a different SSH client, such as Putty. However, OpenSSH is available for Windows, in the form of Copssh. If some of these OpenSSH tips sound useful to you, it may be worth giving Copssh a try (or indeed switching to a different operating system ...).


Copying Files
Shared connections aren’t just a boon with multiple terminal windows; they also make copying files to and from remote servers a breeze. If you SSH to a server and then use the scp command to copy a file to it, scp will make use of your existing SSH connection ‒ and in Bash you even get Tab filename completion on remote files. Connections are also shared with rsync, git, or any other command which uses SSH for connection.


Read more: Smylers
QR: ssh-productivity-tips.html

Posted via email from Jasper-net

0 comments: