transfert de clé SSH

thierryR Membre non connecté
-
- Voir le profil du membre thierryR
- Inscrit le : 02/02/2010
- Site internet
Le wiki ainsi que doc à Adrien ne m'ont pas éclairé.
La clé est transférée sur le serveur. Soit.
Est-il nécessaire de créer un compte client sur le serveur pour enregistrer ces clés ou est-il possible d'enregistrer ces clés sur le compte root est donné un accès à un client sans pour autant créer un compte (/home) client.
J'espère être assez clair.
J'ai remarqué que des l'instant où un /home client est créé il peut lire pas mal de fichier. Je voudrais cloisonner mon client à sa partition et qu'il ne puisse pas fouiner ailleurs.
débusqueur de bugs et chercheur en améliorations
Amicalement vôtre.
Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Adrien.D Membre non connecté
-
- Voir le profil du membre Adrien.D
- Inscrit le : 30/05/2011
- Site internet
- Groupes :
ssh-copy-id root@serveur
ça copie ta clé sur la machine "serveur" avec le compte "root".
T'as donc pas besoin de créer un compte. Root suffit.
Ou alors j'ai rien compris

Config : PC Fixe : X470 GAMING PRO- AMD Ryzen 5 2600X - 16Go RAM - Radeon RX 560 (Pilote libre) - Gentoo Linux - GNOME Desktop - Kernel 5.10 LTS
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !


thierryR Membre non connecté
-
- Voir le profil du membre thierryR
- Inscrit le : 02/02/2010
- Site internet
débusqueur de bugs et chercheur en améliorations
Amicalement vôtre.
Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Adrien.D Membre non connecté
-
- Voir le profil du membre Adrien.D
- Inscrit le : 30/05/2011
- Site internet
- Groupes :



Config : PC Fixe : X470 GAMING PRO- AMD Ryzen 5 2600X - 16Go RAM - Radeon RX 560 (Pilote libre) - Gentoo Linux - GNOME Desktop - Kernel 5.10 LTS
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !


thierryR Membre non connecté
-
- Voir le profil du membre thierryR
- Inscrit le : 02/02/2010
- Site internet
Mais je ne rentre pas en tant que client.
Code BASH :
shh thierry@192.168.1.86
ne fonctionne pas.
pourtant sur le serveur
Citation :
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDO2xoFoDdXkM4Hv/ELC........../iCgSXOf8QSjHBV36xmxc2YjS5uTjGkFGXr1M3JzEbOQeWe3qGysQ3A/ZYwxB5c+xUtPt7 thierry@linuxthierry
C'est quoi que je fais mal ?
débusqueur de bugs et chercheur en améliorations
Amicalement vôtre.
Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Adrien.D Membre non connecté
-
- Voir le profil du membre Adrien.D
- Inscrit le : 30/05/2011
- Site internet
- Groupes :
ssh-copy-id root@serveur
il faut te connecter de la même façon :
ssh root@serveur
La clé tu l'exportes sur une machine distante avec un user distant !
Quand tu fais
ssh moi@serveur
tu te connectes sur la machine distante serveur avec l'utilisateur distant moi
Config : PC Fixe : X470 GAMING PRO- AMD Ryzen 5 2600X - 16Go RAM - Radeon RX 560 (Pilote libre) - Gentoo Linux - GNOME Desktop - Kernel 5.10 LTS
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !


thierryR Membre non connecté
-
- Voir le profil du membre thierryR
- Inscrit le : 02/02/2010
- Site internet
ssh moi@serveur
le mot de passe est demandé. Donc la clé n'est pas trouvée.
Mais si je mets la clé dans le /home/moi/ ça fonctionne impeccable. ( Mais c'est justement ce que je veux pas)
Y aurait-il des permissions à mettre sur le fichier authorized_keys ?
Code BASH :
-rw-r--r-- 1 pi pi 813 déc. 27 23:07 authorized_keys
débusqueur de bugs et chercheur en améliorations
Amicalement vôtre.
Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Adrien.D Membre non connecté
-
- Voir le profil du membre Adrien.D
- Inscrit le : 30/05/2011
- Site internet
- Groupes :
Code BASH :
adrien@oxygen ~ $ ls -lhd .ssh drwx------ 2 adrien adrien 4.0K 27 déc. 23:29 .ssh adrien@oxygen ~ $ ls -lh .ssh total 24K -rw-r--r-- 1 adrien adrien 4.5K 27 déc. 23:29 authorized_keys -rw------- 1 adrien adrien 576 27 déc. 23:29 config -rw------- 1 adrien adrien 1.8K 27 déc. 23:29 id_rsa -rw------- 1 adrien adrien 410 27 déc. 23:29 id_rsa.pub -rw-r--r-- 1 adrien adrien 2.4K 27 déc. 23:29 known_hosts
SSH c'est strictement personnel. Donc le moins de droits.
Sinon, openssh-server refuse d'utiliser une clé si tout le monde a les droits d'écriture dedans.
Config : PC Fixe : X470 GAMING PRO- AMD Ryzen 5 2600X - 16Go RAM - Radeon RX 560 (Pilote libre) - Gentoo Linux - GNOME Desktop - Kernel 5.10 LTS
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !


thierryR Membre non connecté
-
- Voir le profil du membre thierryR
- Inscrit le : 02/02/2010
- Site internet
Code BASH :
-rw------- 1 pi pi 813 déc. 27 23:07 authorized_keys
mais pas plus de résultat.
Je suis sur mon LAN. J'entre donc par le port 22.
ssh moi@serveur dispose d'une partition. Serait ce là l'erreur ?
débusqueur de bugs et chercheur en améliorations
Amicalement vôtre.
Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Adrien.D Membre non connecté
-
- Voir le profil du membre Adrien.D
- Inscrit le : 30/05/2011
- Site internet
- Groupes :
Code BASH :
ls -lhd ~/.ssh
Config : PC Fixe : X470 GAMING PRO- AMD Ryzen 5 2600X - 16Go RAM - Radeon RX 560 (Pilote libre) - Gentoo Linux - GNOME Desktop - Kernel 5.10 LTS
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !


Adrien.D Membre non connecté
-
- Voir le profil du membre Adrien.D
- Inscrit le : 30/05/2011
- Site internet
- Groupes :
Code BASH :
ssh -v moi@serveur
il va te dire ce qu'il ne va pas.
Si t'as pas d'infos :
Code BASH :
ssh -vv moi@serveur
Et si toujours pas d'indications sur la cause de l'erreur, demande le mode super verbeux :
Code BASH :
ssh -vvv moi@serveur
Config : PC Fixe : X470 GAMING PRO- AMD Ryzen 5 2600X - 16Go RAM - Radeon RX 560 (Pilote libre) - Gentoo Linux - GNOME Desktop - Kernel 5.10 LTS
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !


thierryR Membre non connecté
-
- Voir le profil du membre thierryR
- Inscrit le : 02/02/2010
- Site internet
Code BASH :
ssh -v thierry@mamaison OpenSSH_6.6, OpenSSL 1.0.2e 3 Dec 2015 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Connecting to mamaison [192.168.1.86] port 22. debug1: Connection established. debug1: identity file /home/thierry/.ssh/id_rsa type 1 debug1: identity file /home/thierry/.ssh/id_rsa-cert type -1 debug1: identity file /home/thierry/.ssh/id_dsa type -1 debug1: identity file /home/thierry/.ssh/id_dsa-cert type -1 debug1: identity file /home/thierry/.ssh/id_ecdsa type -1 debug1: identity file /home/thierry/.ssh/id_ecdsa-cert type -1 debug1: identity file /home/thierry/.ssh/id_ed25519 type -1 debug1: identity file /home/thierry/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.6 debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-4+deb7u2 debug1: match: OpenSSH_6.0p1 Debian-4+deb7u2 pat OpenSSH* compat 0x04000000 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr hmac-md5 none debug1: sending SSH2_MSG_KEX_ECDH_INIT debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ECDSA ab:55:59:ff:f9:c7:7c:d4:75:48:6e:89:22:99:79:5b debug1: Host 'mamaison' is known and matches the ECDSA host key. debug1: Found key in /home/thierry/.ssh/known_hosts:3 debug1: ssh_ecdsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Offering RSA public key: /home/thierry/.ssh/id_rsa debug1: Authentications that can continue: publickey,password debug1: Trying private key: /home/thierry/.ssh/id_dsa debug1: Trying private key: /home/thierry/.ssh/id_ecdsa debug1: Trying private key: /home/thierry/.ssh/id_ed25519 debug1: Next authentication method: password thierry@mamaison's password:
Je suis surpris qu'il cherche un .ssh sur le client. J'ai donc fais
Code BASH :
sudo ls -la /home/thierry total 40 drwxr-xr-x 5 thierry thierry 4096 déc. 27 23:02 . drwxr-xr-x 4 root root 4096 sept. 25 23:25 .. -rw------- 1 thierry thierry 995 déc. 27 22:59 .bash_history -rw-r--r-- 1 thierry thierry 220 mai 8 2015 .bash_logout -rw-r--r-- 1 thierry thierry 3243 mai 8 2015 .bashrc drwx------ 3 thierry thierry 4096 mai 12 2015 .cache drwx------ 3 thierry thierry 4096 mai 12 2015 .config drwx------ 3 thierry thierry 4096 mai 12 2015 .local -rw-r--r-- 1 thierry thierry 675 mai 8 2015 .profile -rw------- 1 thierry thierry 114 déc. 27 23:02 .Xauthority
Je n'ai pas de dossier .ssh sur le client thierry ???
débusqueur de bugs et chercheur en améliorations
Amicalement vôtre.
Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Adrien.D Membre non connecté
-
- Voir le profil du membre Adrien.D
- Inscrit le : 30/05/2011
- Site internet
- Groupes :
Config : PC Fixe : X470 GAMING PRO- AMD Ryzen 5 2600X - 16Go RAM - Radeon RX 560 (Pilote libre) - Gentoo Linux - GNOME Desktop - Kernel 5.10 LTS
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !


thierryR Membre non connecté
-
- Voir le profil du membre thierryR
- Inscrit le : 02/02/2010
- Site internet
Pour expliquer la manœuvre:
J'ai fait comme tu as indiqué:
ssh-copy-id root@serveur
en clair ça donne:
Code BASH :
ssh-copy-id -i /home/thierry/.ssh/id_rsa.pub "pi@192.168.1.86"
et en résultat on a
Code BASH :
cat .ssh/authorized_keys ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDO2xoFoDdXkM4Hv/ELC................/iCgSXOf8QSjHBV36xmxc2YjS5uTjGkFGXr1M3JzEbOQeWe3qGysQ3A/ZYwxB5c+xUtPt7 thierry@linuxthierry
Avec cette clé je rentre sur le compte root. (pi)
Mais depuis le même PC je ne rentre pas depuis un autre client. (thierry)
Et si je fais:
Code BASH :
ssh-copy-id -i /home/thierry/.ssh/id_rsa.pub "thierry@192.168.1.86"
Je crée un autre fichier authorized_keys dans la partition du même nom. C'est ce que je voudrais éviter.
Voili, voila. Tu sais tout et en détail.
débusqueur de bugs et chercheur en améliorations
Amicalement vôtre.
Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Kernel: 4.4.92-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.35 Distro: Mageia 5 thornicroft
Machine: Mobo: ASUSTeK model: X751SA v: 1.0 Bios: American Megatrends v: X751SA.403
CPU: Quad core Intel Pentium N3710 (-MCP-) cache: 1024 KB Graphics: Card: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller

Adrien.D Membre non connecté
-
- Voir le profil du membre Adrien.D
- Inscrit le : 30/05/2011
- Site internet
- Groupes :
Avec
Code BASH :
ssh-copy-id -i /home/thierry/.ssh/id_rsa.pub "pi@192.168.1.86"
tu peux te connecter uniquement sur le compte "pi" pas sur les autres !!!!
Tu dois impérativement faire
Code BASH :
ssh-copy-id -i /home/thierry/.ssh/id_rsa.pub "thierry@192.168.1.86"
Si tu veux envoyer ta clé sur le compte distant thierry.
Pour régler ton problème (si je le comprends bien) soit tu ne gardes que le compte "pi" et puis depuis celui-ci une fois connecté tu fais un
Code BASH :
su - thierry
pour changer d'utilisateur.
Soit tu créées une autre clé (avec un autre nom) sur ton PC pour l'envoyer sur le serveur distant
Config : PC Fixe : X470 GAMING PRO- AMD Ryzen 5 2600X - 16Go RAM - Radeon RX 560 (Pilote libre) - Gentoo Linux - GNOME Desktop - Kernel 5.10 LTS
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !
Ancien Webmaster de MageiaLinuxOnline. Les remplaçants assurent !

Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie