You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

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.

ssh-keygen

 change passphrase of default key if needed

ssh-keygen -p

copy to servers ( if password login allowed)

ssh-copy-id login@servername 

ssh-agent

ssh-agent autostart

.bashrc
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

sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
service sshd restart


  • No labels