SSH Private Key Login
1. How to Generate Key File
sudo ssh-keygen -t rsa -b 4096 ; cd /root/.ssh/; cat id_rsa.pub >> authorized_keys ; chmod 600 authorized_keys && chmod 700 ~/.ssh ; ls -ld ; cat /etc/ssh/sshd_config ; vim /etc/ssh/sshd_config ; systemctl restart sshd.service ;
2. RSA to PPK or Vice Versa (e.g.: in homebrew )
brew install putty ; puttygen id_rsa -o id_rsa.ppk; puttygen id_rsa.ppk -O private-openssh -o id_rsa.pem ;
3. If system reminds “permissions *** for ***are too open”, then change it as below (Note: please modify the file path as your own) :
chmod 600 ~/Users/test/id_rsa ;
4. If system reminds “The authenticity of host ‘[8.8.8.8]:12345 ([8.8.8.8]:12345)’ can’t be established.” or ” ECDSA key fingerprint is SHA256: **********.”, just try as below:
4.1
ssh-add -l ;
4.2 if it shows “The agent has no identities.”, then try as below (Note: please modify the file path as your own) :
ssh-add ~/Users/test/id_rsa ;
It will show “Identity added: ~/Users/test/id_rsa ([email protected])