Keychain is a manager for OpenSSH, ssh.com, Sun SSH and GnuPG agents. It acts as a front-end to the agents, allowing you to easily have one long-running agent process per system, rather than per login session. This dramatically reduces the number of times you need to enter your passphrase from once per new login session to once every time your local machine is rebooted.
Install Keychain
rpm -Uvh http://packages.psychotic.ninja/7/base/x86_64/RPMS/psychotic-release-1.0.0-1.el7.psychotic.noarch.rpm
yum --enablerepo=psychotic install keychain.
Add a new user
adduser happy
Log on to your new user
su happy
CREATE SSH KEY
Kindly following this article Step2 to create your pair of the keys.
We are strongly recommended that using a praphase for you secret keys.
And now we use below command at your server for transfer key to the client machine.
ssh-copy-id -i ~/.ssh/id_rsa user@123.123.213.123 Then enter the password and you will see something like below:
Number of key(s) added: 1
Now try logging into the machine, with: “ssh ‘user@123.123.213.123’”
and check to make sure that only the key(s) you wanted were added.
With using the highlighted text of ssh on your server, you may need to enter paraphase every single time to remote access to your client.
Log off from the client machine and log in back to the root user.
Grant sudo permission for new user
vi /etc/sudoer Add this under root happy ALL=(ALL) ALL
Configure keychain for the new user
cd /home/happy/ vi .bash_profile Insert these: ### START-Keychain ### # Let re-use ssh-agent and/or gpg-agent between logins /usr/bin/keychain $HOME/.ssh/id_rsa source $HOME/.keychain/$HOSTNAME-sh ### End-Keychain ###
Take effect for your configuration
source .bash_profile *you will ask to key in your paraphase once*
We are done for the keychain. Next , we need to configure some setting to access the client machine with hostname.
configure to ssh hostname without port and ip needed.
vim /home/happy/.ssh/config Host webclient HostName 192.168.0.222 Port 22299 User happy
ssh to other server
ssh webclient
EXAMPLE: [happy@monitor .ssh]$ ssh webclient Last login: Wed Sep 6 16:14:15 2017 from 192.168.0.221 [happy@webclient ~]$
Leave a Reply
Want to join the discussion?Feel free to contribute!