Howardism Musings from my Awakening Dementia
My collected thoughts flamed by hubris
Home PageSend Comment

Installing SSH Public Keys

Each new laptop or workstation, whether a Mac or a Linux (there is no other, right?), I always end up SSHing to my servers. This means, I always do the following steps:

  1. Create a public and private key pair
  2. Uploading the public key to my server

Since I often forget the details (and it usually ends up being repetitive work), I wrote a shell script that I thought I would share. Feel free to use it and customize it.

The following options are available:

  • -u username -- Specify the remote username. Defaults to $USER
  • -h hostname -- Specify the remote host. May or may not include the domain name
  • -d domain -- Specify the remote domain name.

If the -h option is not specified, the first parameter is assumed to be the host name.

The following are 3 examples of running the script:

$ sh ssh-pubkey-installer.sh  -u habrams -h dvvrhel04 -d iovation.us

$ sh ssh-pubkey-installer.sh  -h dvvrhel04.iovation.us

$ sh ssh-pubkey-installer.sh  dvvrhel04.iovation.us
Tell others about this article:
Click here to submit this page to Stumble It