...
Code Block |
---|
title | ssh-keygen |
---|
collapse | true |
---|
| passphrase = ansible123
/project # ssh-keygen
!!!!! default wull use: root
!!!!! and will put it in /root/.ssh/
/project # ssh-keygen -t rsa -f /project/id_rsa -P ansible123 -C ansible
Generating public/private rsa key pair.
Your identification has been saved in /project/id_rsa.
Your public key has been saved in /project/id_rsa.pub.
The key fingerprint is:
SHA256:gjLEcnkqJ5bE6O/KBH5c1mGle6clTJNqDvQ+72CIy0w ansible
The key's randomart image is:
+---[RSA 2048]----+
| . |
|o. . o . |
|oo= .. + + |
|o+.o..+ * . |
|++= .+.*S+ o |
|++oo+ *.. = |
| o E . * . |
|o * . . + |
| o.= .o |
+----[SHA256]-----+ |
Code Block |
---|
title | id_rsa.pub on the vMX |
---|
collapse | true |
---|
| Key on the vMX
root@vMX1% ls /var/home/ansible/:
.ssh id_rsa.pub
root@vMX1% more /var/home/ansible/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/DLTV+Qzxxxxxxxxxxxxxx6egBTuBB+60d ansible
>>> notice the "ansible" at the end of the public key <<<<<<< |
|
Code Block |
---|
title | show keys |
---|
collapse | true |
---|
| /project # more id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAxxxxxxxxxxxxxxxxxxxxxxxPhGutC3GzMrtI+oYiT ansible
/project # more id_rsa
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,05388A42A5804ABDF36414653984ABE6
vMRf+ef7ZuiS1nnur4HsAgF+I+ZLkj0gUqvfAQMVCn8HPy1fU7pV7YjhUuGRqfa+
FtDSP6OChx9pU+UBS+Q/6d+FRWhdOvJxfG2Rjrs4i4uc4STyn6N393Ns5M9quEjc
tARO9EOcROR73xtXws03jRewwj1YF8rCa+c3jytRzz/IwZZX617t3ANk38s9KKX2
u1H1KCkzDZTTUO7Zp37yzpRa/YIcQ6g8iYuSMgWedzkasolBSLpgGTz+Qg2FrN2+
3jPksBZd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tDlHbQUZf0teynZqK//LJMoa3WWQk+xXvaD
HjFju/GGZFLy/pDDMucJv7eyUAI3Rl3clvpdrWt3jAHX4IkSJJM728KZ81SwR3w9
EB6Zl7wvUEWHoZtHW1E61k9QubPYXN6tyb/Gt5AdR35s2aU4mY3v43Av3+lznslb
ja1oHKvMuAQZ/LoN+ev4+U6IaIhA7BydN5KnS7Ekr0ntwWJGyJvXUxMlEDdd6/QN
EzVhd12EjTSh4jTsrb150gaWhGs7RmBRLPqKoU89nz5/xxCDA9/5yh2/ARss2zqJ
-----END RSA PRIVATE KEY-----
/project #
!!!!!!! if using defaut ( root account ) !!!!!!!
/project # ls /root/.ssh/
id_rsa id_rsa.pub known_hosts
/project # more /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAxxxxxxxxxxxxxxxxxxxx root@fd9589e5bc79
/project #
|
|
---|
...
( or with sftp tool like mobaxterm )
Code Block |
---|
title | sftp ansible@192.168.99.11 |
---|
collapse | true |
---|
| /project # sftp ansible@192.168.99.11
ansible@192.168.99.11's password:
Connected to 192.168.99.11.
sftp> put /project/id_rsa.pub
Uploading /project/id_rsa.pub to /var/home/ansible/id_rsa.pub
/project/id_rsa.pub 100% 389 298.9KB/s 0.4KB/s 00:00
sftp> ls
id_rsa.pub
sftp> pwd
Remote working directory: /var/home/ansible
sftp> exit
/project # |
| Image Modified
Check: after the ssh-copy-id, on the remote server: before/after ( /root/.ddh or /home/<username>/.ssh/ )
Image Modified
|
---|
3- To set up SSH agent to avoid retyping passwords, you can do:
...