? Earlier 2 items total Later ?

On this page:?

Bash function to copy SSH DSA public key to a new server

Or, "How to login over SSH without a password".

First of all, you'll need to have generated an SSH public DSA key using the following commands:

cd ~ && ssh-keygen -t dsa


Then, you can add the following bash function to your .bashrc (or similar) and just type 'scpdsa user@hostname' to add your public key to your 'authorized_keys' file on the server.

function scpdsa {
        if [ ! -n "$1" ];
        then
                echo "!! You need to enter a hostname in order to send your public key !!" 
        else
                echo "* Copying SSH public key to server..." 
                scp ~/.ssh/id_dsa.pub $1:~/id_dsa_temp.pub
                echo "* Adding SSH public key to 'authorized_keys' on server..."
                ssh $1 'cat ~/id_dsa_temp.pub >> ~/.ssh/authorized_keys'
                echo "* Removing temporary files from server..."
                ssh $1 'rm ~/id_dsa_temp.pub'
                echo "* All done!"
        fi
}

Generate secure ssh keys

Here's how to get to a quick secure shell login. On your computer (replace all values in CAPS of course):

cd ~
ssh-keygen -t dsa


(just hit return at any prompts, even if it asks for a password). Then:

scp ~/.ssh/id_dsa.pub [email protected]:~/.ssh/authorized_keys


And put in the password for your account when prompted. Next, add the following to ~/.ssh/config:

Host SOMESHORTCUT
Port 22
User YOURUSER
Hostname YOURSERVER.textdrive.com
KeepAlive yes                                                                   


Restart the local shell, and then whenever you want to login to your server, just type:

ssh SOMESHORTCUT


...and you'll zip right in.

? Earlier 2 items total Later ?