2015-11-15

Perform SSH and cat Without Entering Password on openSSH while ssh-copy-id not available





Reference from URL below.

Source URL: http://www.thegeekstuff.com/2008/06/perform-ssh-and-scp-without-entering-password-on-openssh/

Perform SSH and SCP Without Entering Password on openSSH





Check if rsa keys(private & public) been created:

  1. private key = id_rsa
  2. public key = id_rsa.pub




ls -lrth /root/.ssh/



If not created then create rsa key, if created ( id_rsa & id_rsa.pub ) then skip to prevent existing authentication to be overwrite. 

by default, is using rsa

ssh-keygen

or

ssh-keygen -t rsa



Copy public key to target remote server.

ssh-copy-id ~/.ssh/id_rsa.pub <user_id>@<ip_or_domain>

or

cat id_rsa.pub | ssh <user_id>@<ip_or_domain> 'cat >> .ssh/authorized_keys && echo "Key copied"'

<user_id>@<ip_or_domain>'s password:
Key copied



After copy by keyin target remote server password, by right should be able to ssh without password for sub sequence access.

ssh <user_id>@<ip_or_domain>




If happen to hit this Error:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0744 for '/home/geek/.ssh/id_rsa' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /home/geek/.ssh/id_rsa


Then could solve by using script below:

sudo chmod 600 ~/.ssh/id_rsa*



Source URL: http://www.howtogeek.com/168119/fixing-warning-unprotected-private-key-file-on-linux/


Fixing “WARNING: UNPROTECTED PRIVATE KEY FILE!” on Linux


















No comments:

Google Referrals