SSH login requires password to be specified. In order to programmatic login to target server with needing to specify password, we can use SSH Key.
In this post, I’ll use Vertica Development server as source and Vertica production server as target In other words I’ll set up password less login for my ID from Development server to Production server.
|Development server: CENTOS65 for user sbalas002c|
Production Server: 172.24.202.79 for user dbadmin
Generate SSH Key at the source server (Do not enter passphrase)
[sbalas002c@CENTOS65 ~]$ ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/opt/home/sbalas002c/.ssh/id_dsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /opt/home/sbalas002c/.ssh/id_dsa. Your public key has been saved in /opt/home/sbalas002c/.ssh/id_dsa.pub. The key fingerprint is: ea:37:86:ac:83:ea:1c:e6:ec:00:96:4d:00:56:80:c1 sbalas002c@CENTOS65 ~]$ The key's randomart image is: +--[ DSA 1024]----+ |*=o. | |oE. | | . | | + | |.o . S | |o . | |.o . ... | |* o ..o + | |+B .o.o . | +-----------------+
[sbalas002c@CENTOS65 ~]$ [sbalas002c@CENTOS65 ~] $ sftp email@example.com Connecting to 172.24.202.79... firstname.lastname@example.org's password: sftp> put /opt/home/sbalas002c/.ssh/id_dsa.pub .ssh/. Uploading /opt/home/sbalas002c/.ssh/id_dsa.pub to /home/dbadmin/.ssh/./id_dsa.pub /opt/home/sbalas002c/.ssh/id_dsa.pub 100% 616 0.6KB/s 00:00 sftp> quit HERE ************ Login to target server and add the key to .ssh/authorized_keys ***************** [sbalas002c@CENTOS65 ~] $ ssh email@example.com Last login: Wed Dec 3 11:29:06 2014 from 10.52.144.12 -bash-4.1$