Showing posts with label ssh. Show all posts
Showing posts with label ssh. Show all posts

Wednesday, September 23, 2009

Mandating key-based logins with sshd

This page provides a pretty good summary of creating a public/private key pair on the client and adding the public key to the server's authorized_keys file.

On the server side, edit /etc/ssh/sshd_config and add the directive PasswordAuthentication no and then restart sshd with sudo /etc/init.d/ssh restart Anyone that tries to log in to your server without a public key in the server's authorized_keys file will now not even be given the chance to enter a password.

sshd_config manpage

Monday, July 21, 2008

Keep SSH connections from timing out, client-side

Put these lines in ~/.ssh/config

ServerAliveInterval 300
TCPKeepAlive yes

Sunday, August 06, 2006

OpenSSH Installation, SCP, SFTP

Installation of OpenSSH was a breeze. Just one command from Breezy Badger (Ubuntu 5.10) server installed it on my server: apt-get install openssh-server. Now I can administer my box from anywhere! Yay! (provided, of course, no power outages, etc...)

To SSH into a server: ssh <username>@<ip address>

To upload a directory recursively (with encryption... blowfish is an encryption algorithm and scp stands for secure copy protocol, a utility available on almost all UNIX-derived machines): scp [-c blowfish] -r <source path> <username>@<target ip address>:<target path> To download over scp, switch the source and target.

For example, to upload from your music collection:
scp -r /home/<username>/Desktop/Musical/Music/Depeche\ Mode/ <username>@<server address>:/home/<username>/Musical/Music/

And to do the opposite (download a directory from the server, in this example to the current directory): scp -r <username>@<server address>:/home/<username>/Musical/ .

Another option is sftp which can perform ftp-like operations (including interactive sessions) over an ssh connection.

Links:
Manpages: