ssh key
Generate key pair
with default names ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub. For security reasons highly recomended to use only passphrase protected keys.
change passphrase of default key if needed
copy to servers ( if password login allowed)
Code Block |
---|
|
ssh-copy-id login@servername |
ssh-agent
ssh-agent autostart
Code Block |
---|
|
AGENT=`ps -ef |grep ssh-agent|grep $USER|grep -v grep`
if [ "${AGENT}" = "" ];
then
ssh-agent > .ssh/agent_env
source .ssh/agent_env
else
source .ssh/agent_env
fi
KEYLIST=`ssh-add -l`
if [ "${KEYLIST}" = "The agent has no identities." ];
then
ssh-add
fi |
enable passwords
Code Block |
---|
sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
service sshd restart |