Laisser les valeurs par défaut
Sur wctsrv0134
cd /root/.ssh/ root@wctsrv0134:/exploit/scripts# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): [entrée] LAISSER LA VALEUR PAR DEFAUT Enter passphrase (empty for no passphrase): [entrée] Enter same passphrase again: [entrée] Your identification has been saved in /root/.ssh/id_rsa_vtom_main. Your public key has been saved in /root/.ssh/id_rsa_vtom_main.pub. The key fingerprint is: SHA256:c29bbI+32cezIzf97+W75tGjinKSBOjpEW3W1rPRF68 root@wctsrv0011 The key's randomart image is: +---[RSA 2048]----+ | | | . | | o . . . o | | o = o + . . . | | . = o S = . . | | + . + . E .| | . . . . o +++| | . + … =.X@| | +. .o.*X^| +----[SHA256]-----+
root@wctsrv0134:/exploit/scripts# cd /root/.ssh/ root@wctsrv0134:~/.ssh# ll total 32 drwx------ 2 root root 4096 Oct 4 14:00 ./ drwx------ 8 root root 4096 Oct 4 11:33 ../ -rw------- 1 root root 0 Feb 12 2019 authorized_keys -rw------- 1 root root 668 Oct 4 11:39 id_dsa -rw------- 1 root root 605 Oct 4 11:39 id_dsa.pub -rw------- 1 root root 1675 Oct 4 14:00 id_rsa -rw-r----- 1 root root 397 Oct 4 14:00 id_rsa.pub -rw-r--r-- 1 root root 5096 May 15 13:31 known_hosts root@wctsrv0134:~/.ssh# cp id_rsa.pub /home/vtom/.ssh/ root@wctsrv0134:~/.ssh# cd /home/vtom/.ssh/ root@wctsrv0134:/home/vtom/.ssh# ll total 32 drwx------ 2 vtom vtom 4096 Oct 4 14:19 ./ drwxr-x--x 11 vtom vtom 4096 Sep 10 16:47 ../ rw------- 1 vtom vtom 397 May 15 16:08 authorized_keys -rw------- 1 vtom vtom 668 Oct 4 14:02 id_dsa -rw------- 1 vtom vtom 1679 May 15 16:01 id_rsa -rw-r----- 1 vtom vtom 397 May 15 16:01 id_rsa.pub -rw-r----- 1 root root 397 Oct 4 14:19 id_rsa.pub -rw-r--r-- 1 vtom vtom 3540 May 17 07:53 known_hosts
root@wctsrv0134:/home/vtom/.ssh# chown vtom:vtom id_rsa.pub root@wctsrv0134:/home/vtom/.ssh# chmod 600 id_rsa.pub root@wctsrv0134:/home/vtom/.ssh# ll total 32 drwx------ 2 vtom vtom 4096 Oct 4 14:19 ./ drwxr-x--x 11 vtom vtom 4096 Sep 10 16:47 ../ -rw------- 1 vtom vtom 397 May 15 16:08 authorized_keys -rw------- 1 vtom vtom 668 Oct 4 14:02 id_dsa -rw------- 1 vtom vtom 1679 May 15 16:01 id_rsa -rw-r----- 1 vtom vtom 397 May 15 16:01 id_rsa.pub -rw------- 1 vtom vtom 397 Oct 4 14:19 id_rsa.pub -rw-r--r-- 1 vtom vtom 3540 May 17 07:53 known_hosts
root@wctsrv0134:~/.ssh# su - vtom vtom@wctsrv0134:~/.ssh# cd /home/vtom/.ssh/ vtom@wctsrv0134~$ ssh-copy-id -f -i id_rsa.pub wctsrv0135 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id_rsa.pub" WARNING: Unauthorized access to this system is forbidden and will be prosecuted by law. By accessing this system, you agree that your actions may be monitored if unauthorized usage is suspected. Ubuntu 18.04.1 LTS Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'wctsrv0135'" and check to make sure that only the key(s) you wanted were added.
vtom@wctsrv0134:~$ ssh wctsrv0135
WARNING: Unauthorized access to this system is forbidden and will be
prosecuted by law. By accessing this system, you agree that your actions
may be monitored if unauthorized usage is suspected.
Ubuntu 18.04.1 LTS
vtom@wctsrv0135:~$
—–> OK
sources : https://www.microlinux.fr/cle-ssh/
Copier le fichier id_rsa.pub sur les autres serveurs pour une authentification sans pwd.
cd /home/vtom/.ssh
ssh-copy-id -f -i id_rsa.pub wctsrv0055
ssh-copy-id -f -i id_rsa.pub wctsrv0056
ssh-copy-id -f -i id_rsa.pub wctsrv0060
… etc…