Skip to main content
step by step
Source Link
Archemar
  • 32.3k
  • 18
  • 75
  • 107

there is a confusion

ssh -vv -i .ssh/authorized_keys -o PasswordAuthentication=no [email protected] 

authorized_keys is a list of public keys you allow to connect.

this file should be set on server side.

you must connect using your private keys, likely

ssh -i .ssh/id_rsa [email protected] 

step 1 (client)

connect to 192.168.12.10 with user ansible and type:

mkdir .ssh ; chmod go-rwx .ssh ; cd .ssh ssh-keygen -t rsa 

Accept default option, do not set password.

Do this only one, do not do it if there is already a pair of key.

if password for ansible is know, copy file id_rsa.pub using

scp id_rsa.pub [email protected]:.ssh/id_rsa_ansible.pub 

The first time you ssh or scp from 192.168.12.10 to 192.168.12.2, you will have a confirmation dialog.

[email protected]:hosts.ansible The authenticity of host '192.168.12.10' can't be established. RSA key fingerprint is 89:dc:fe:d6:4a:40:28:e5:e9:d0:bd:09:28:01:93:23. Are you sure you want to continue connecting (yes/no)? y 

if password in unknow or unset, copy the line from id_rsa.pub using putty buffer

step 2 (server)

Connect to 192.168.12.2 with user ansible

mkdir .ssh ; chmod go-rwx .ssh ; cd .ssh 

Create authorization files

cat id_rsa_ansible.pub >> authorized_keys 

or copy/paste content of id_rsa.pub file from ansible

authorized_keys must :

  • belong either to ansible (or root)

    chown ansible authorized_keys 
  • ansible must be only writer (rw-r--r--)

    chmod 644 authorized_keys 

verification

connect to 192.168.12.10 with user ansible

ssh [email protected]

ssh [email protected] 

You should connect without having to type password


I already have a web page detailing those steps (in french and english), you can enter usernames and hostnames. detail of ssh setup

there is a confusion

ssh -vv -i .ssh/authorized_keys -o PasswordAuthentication=no [email protected] 

authorized_keys is a list of public keys you allow to connect.

this file should be set on server side.

you must connect using your private keys, likely

ssh -i .ssh/id_rsa [email protected] 

step 1 (client)

connect to 192.168.12.10 with user ansible and type:

mkdir .ssh ; chmod go-rwx .ssh ; cd .ssh ssh-keygen -t rsa 

Accept default option, do not set password.

Do this only one, do not do it if there is already a pair of key.

if password for ansible is know, copy file id_rsa.pub using

scp id_rsa.pub [email protected]:.ssh/id_rsa_ansible.pub 

The first time you ssh or scp from 192.168.12.10 to 192.168.12.2, you will have a confirmation dialog.

[email protected]:hosts.ansible The authenticity of host '192.168.12.10' can't be established. RSA key fingerprint is 89:dc:fe:d6:4a:40:28:e5:e9:d0:bd:09:28:01:93:23. Are you sure you want to continue connecting (yes/no)? y 

if password in unknow or unset, copy the line from id_rsa.pub using putty buffer

step 2 (server)

Connect to 192.168.12.2 with user ansible

mkdir .ssh ; chmod go-rwx .ssh ; cd .ssh 

Create authorization files

cat id_rsa_ansible.pub >> authorized_keys 

or copy/paste content of id_rsa.pub file from ansible

authorized_keys must :

  • belong either to ansible (or root)

    chown ansible authorized_keys 
  • ansible must be only writer (rw-r--r--)

    chmod 644 authorized_keys 

verification

connect to 192.168.12.10 with user ansible

ssh [email protected]

You should connect without having to type password


I already have a web page detailing those steps (in french and english), you can enter usernames and hostnames.

there is a confusion

ssh -vv -i .ssh/authorized_keys -o PasswordAuthentication=no [email protected] 

authorized_keys is a list of public keys you allow to connect.

this file should be set on server side.

you must connect using your private keys, likely

ssh -i .ssh/id_rsa [email protected] 

step 1 (client)

connect to 192.168.12.10 with user ansible and type:

mkdir .ssh ; chmod go-rwx .ssh ; cd .ssh ssh-keygen -t rsa 

Accept default option, do not set password.

Do this only one, do not do it if there is already a pair of key.

if password for ansible is know, copy file id_rsa.pub using

scp id_rsa.pub [email protected]:.ssh/id_rsa_ansible.pub 

The first time you ssh or scp from 192.168.12.10 to 192.168.12.2, you will have a confirmation dialog.

[email protected]:hosts.ansible The authenticity of host '192.168.12.10' can't be established. RSA key fingerprint is 89:dc:fe:d6:4a:40:28:e5:e9:d0:bd:09:28:01:93:23. Are you sure you want to continue connecting (yes/no)? y 

if password in unknow or unset, copy the line from id_rsa.pub using putty buffer

step 2 (server)

Connect to 192.168.12.2 with user ansible

mkdir .ssh ; chmod go-rwx .ssh ; cd .ssh 

Create authorization files

cat id_rsa_ansible.pub >> authorized_keys 

or copy/paste content of id_rsa.pub file from ansible

authorized_keys must :

  • belong either to ansible (or root)

    chown ansible authorized_keys 
  • ansible must be only writer (rw-r--r--)

    chmod 644 authorized_keys 

verification

connect to 192.168.12.10 with user ansible

ssh [email protected] 

You should connect without having to type password


I already have a web page detailing those steps (in french and english), you can enter usernames and hostnames. detail of ssh setup

step by step
Source Link
Archemar
  • 32.3k
  • 18
  • 75
  • 107

there is a confusion

ssh -vv -i .ssh/authorized_keys -o PasswordAuthentication=no [email protected] 

authorized_keys is a list of public keys you allow to connect.

this file should be set on server side.

you must connect using your private keys, likely

ssh -i .ssh/id_rsa [email protected] 

step 1 (client)

connect to 192.168.12.10 with user ansible and type:

mkdir .ssh ; chmod go-rwx .ssh ; cd .ssh ssh-keygen -t rsa 

Accept default option, do not set password.

Do this only one, do not do it if there is already a pair of key.

if password for ansible is know, copy file id_rsa.pub using

scp id_rsa.pub [email protected]:.ssh/id_rsa_ansible.pub 

The first time you ssh or scp from 192.168.12.10 to 192.168.12.2, you will have a confirmation dialog.

[email protected]:hosts.ansible The authenticity of host '192.168.12.10' can't be established. RSA key fingerprint is 89:dc:fe:d6:4a:40:28:e5:e9:d0:bd:09:28:01:93:23. Are you sure you want to continue connecting (yes/no)? y 

if password in unknow or unset, copy the line from id_rsa.pub using putty buffer

step 2 (server)

Connect to 192.168.12.2 with user ansible

mkdir .ssh ; chmod go-rwx .ssh ; cd .ssh 

Create authorization files

cat id_rsa_ansible.pub >> authorized_keys 

or copy/paste content of id_rsa.pub file from ansible

authorized_keys must :

  • belong either to ansible (or root)

    chown ansible authorized_keys 
  • ansible must be only writer (rw-r--r--)

    chmod 644 authorized_keys 

verification

connect to 192.168.12.10 with user ansible

ssh [email protected]

You should connect without having to type password


I already have a web page detailing those steps (in french and english), you can enter usernames and hostnames.

there is a confusion

ssh -vv -i .ssh/authorized_keys -o PasswordAuthentication=no [email protected] 

authorized_keys is a list of public keys you allow to connect.

this file should be set on server side.

you must connect using your private keys, likely

ssh -i .ssh/id_rsa [email protected] 

there is a confusion

ssh -vv -i .ssh/authorized_keys -o PasswordAuthentication=no [email protected] 

authorized_keys is a list of public keys you allow to connect.

this file should be set on server side.

you must connect using your private keys, likely

ssh -i .ssh/id_rsa [email protected] 

step 1 (client)

connect to 192.168.12.10 with user ansible and type:

mkdir .ssh ; chmod go-rwx .ssh ; cd .ssh ssh-keygen -t rsa 

Accept default option, do not set password.

Do this only one, do not do it if there is already a pair of key.

if password for ansible is know, copy file id_rsa.pub using

scp id_rsa.pub [email protected]:.ssh/id_rsa_ansible.pub 

The first time you ssh or scp from 192.168.12.10 to 192.168.12.2, you will have a confirmation dialog.

[email protected]:hosts.ansible The authenticity of host '192.168.12.10' can't be established. RSA key fingerprint is 89:dc:fe:d6:4a:40:28:e5:e9:d0:bd:09:28:01:93:23. Are you sure you want to continue connecting (yes/no)? y 

if password in unknow or unset, copy the line from id_rsa.pub using putty buffer

step 2 (server)

Connect to 192.168.12.2 with user ansible

mkdir .ssh ; chmod go-rwx .ssh ; cd .ssh 

Create authorization files

cat id_rsa_ansible.pub >> authorized_keys 

or copy/paste content of id_rsa.pub file from ansible

authorized_keys must :

  • belong either to ansible (or root)

    chown ansible authorized_keys 
  • ansible must be only writer (rw-r--r--)

    chmod 644 authorized_keys 

verification

connect to 192.168.12.10 with user ansible

ssh [email protected]

You should connect without having to type password


I already have a web page detailing those steps (in french and english), you can enter usernames and hostnames.

Source Link
Archemar
  • 32.3k
  • 18
  • 75
  • 107

there is a confusion

ssh -vv -i .ssh/authorized_keys -o PasswordAuthentication=no [email protected] 

authorized_keys is a list of public keys you allow to connect.

this file should be set on server side.

you must connect using your private keys, likely

ssh -i .ssh/id_rsa [email protected]