SSH

By Druss , 20 March, 2015

So, I am often SSH'd into a remote server from my Kubuntu desktop. I also rarely switch off my desktop and prefer to just hit sleep instead. One of the things that can be annoying when I resume the desktop is that the previous SSH session is now unresponsive/frozen as SSH believes that it is still connected to the remote server while the server has given up on the old session long ago. No amount of CTRL + C or CTRL + Z banging is going to terminate the session which can take an inordinately long wait to time out.

Tags Old
By Druss , 1 September, 2014

I ran into the following error while running a script that was performing backups of files via rsync over ssh.

error: ssh: connect to host foo.example.com port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(601) [sender=3.0.7]

By Druss , 31 January, 2014

Fresh install of Ubuntu Server 12.04 LTS: After installed SSHD, I found that logging in remotely was a time-consuming process as the password prompt took ages to pop up after the username prompt. Binging about, I found that this was due to SSHD performing a reverse DNS lookup of my IP to potentially check if all is kosher. Turning this check off fixes the issue:

By Druss , 28 January, 2014

All those who SSH into servers ought to use GNU Screen. The following is some additional configuration that can be added to a .screenrc file in your home directory. These lines do wonders to the usability of the system:

caption string "%?%F%{= Bk}%? %C%A %D %d-%m-%Y %{= kB} %t%= %?%F%{= Bk}%:%{= wk}%? %n "
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'

By Druss , 24 June, 2013

Instead of having to look up the exact syntax for pscp every time, here's a list of examples for future reference. In these examples, I'm transferring a file (bar.zip) from a Windows host to a Linux server (with the destination path of /home/druss/Desktop/).

"C:\Program Files (x86)\PuTTY\pscp.exe" -scp -P 2134 -pw mypassword bar.zip druss@foo.dyndns.info:/home/druss/Desktop/

By Druss , 24 November, 2012

In Linux, you can simplify some of your SSH commands using an SSH config file. For example, create a file named config in your ~/.ssh directory with something like the following:


Host bar
HostName bar.examplecom
User bar user

Host foo
HostName foo.example.com
User foouser

This will allow you to ssh into the specified hosts using short commands such as ssh foo and ssh bar.

Tags Old

Tags

By Druss , 29 June, 2011

So, if you, like me, have to resort to PuTTY sometimes to SSH into a Linux box, I'm sure that you have also subjected yourself to much gnashing of teeth at the lack of a Windows solution to password-less logins into your server. For the uninitiated, password-less SSH allows you to log into a server without manually authenticating yourself.

All times are UTC. All content licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.