Strict Standards: Declaration of RSS::DoAction() should be compatible with CMSModule::DoAction($name, $id, $params, $returnid = '') in /home/xandaorg/public_html/modules/RSS/RSS.module.php on line 0

Strict Standards: Non-static method PageInfoOperations::LoadPageInfoByContentAlias() should not be called statically in /home/xandaorg/public_html/index.php on line 154
Xanda - /dev/project - SSH Public key based authentication

This howto covers generating and using ssh keys for automated:

  • Login
  • Make backups
  • Run commands from shell etc

Generating SSH Keys

  • Logon on to your workstation ( for example log on to workstation called admin.fbsd.nixcraft.org as vivek user). Please refer the following sample setup - You will be log in, on your local system, AS THE USER you wish to make passwordless ssh connections.
  • Create the Cryptographic Key on FreeBSD workstation, enter:
$ ssh-keygen -t rsa

Assign the pass phrase (press [enter] key twice if you don’t want a passphrase). It will create 2 files in ~/.ssh directory as follows:

  • ~/.ssh/id_rsa : identification (private) key
  • ~/.ssh/id_rsa.pub : public key
  • Use scp to copy the id_rsa.pub (public key) to rh9linux.nixcraft.org server as authorized_keys2 file, this is know as Installing the public key to server.
$ scp .ssh/id_rsa.pub vivek@rh9linux.nixcraft.org:.ssh/authorized_keys2
  • From FreeBSD workstation login to server:
$ ssh rh9linux.nixcraft.org
  • Changing the pass-phrase on workstation (if needed):
$ ssh-keygen -p
  • Use of ssh-agent to avoid continues pass-phrase typing

At freebsd workstation type:

$ ssh-agent $BASH
$ ssh-add

Type your pass-phrase

From here, whenever connecting to server it won’t ask for password.
Above two commands can be added to ~/.bash_profile so that as soon as I login into workstation I can set the agent.

Deleting the keys hold by ssh-agent

  • To delete all keys
$ ssh-add -D 
  • To delete specific key
$ ssh-add -d key
  • To list keys
$ ssh-add -l

[The content of this page is taken from Cyberciti. Feel free to visit the original site because who knows the original author might update the content from time to time]