fichero OpenSSH.GitHub
cat ~/.ssh/OpenSSH.GitHub
1
2
3
4
5
6
7
8
9
10
11
12
13
| -----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,4AFCBF8D0AF1ABB6
+G1vplr+DfWb2h/a04BfdsfdsffYcqewrwrewvH5RYcqi4Q4eqhjj5UIXF6cQ5ZY
pqIWBBmC3sIwkztnCZC5KqMYjLy9hbDdFQ5EplW3QN7wV9Bs2PXRl0NIDWMBicjS
em+jS0365JIle+ofYPeGiZIjZq6VxUQJeVgIFG56AWP/Vq9nvHjvblwOl5rFQaLh
nDJT+06jmkhFlN6sdfdfdsfdfS4MdOlPQkJBvfdhOJ4viUYfdjspy2NjuMvXH2Wb
rIHC0wtYFiNhPTCeCXfEXqv7Fhw2bBZM//W/oqleyz+Y5EBlWZLcyqG6FYtHTEkL
Mh6Y4NL8XMqg3Gly9PKH0RfT2mJYJhN1ni1KBn6H6SXzlLU5bKgfM8aNJ9RVS9it
rQ4B38i8HuoS6lOvIAdsfsdffffssffODyrMi0kREuvQC5fhfuQB83cn1lx5u/Ut
ETC......
-----END RSA PRIVATE KEY-----
|
Creamos el directorio para las claves y ponemos las claves en el con los permisos adecuados
1
2
3
4
5
| mkdir -p ~/.ssh
touch ~/.ssh/OpenSSH.GitHub
vim ~/.ssh/OpenSSH.GitHub # guardamos el contenido de la clave privada
chmod 600 ~/.ssh/OpenSSH.GitHub # le quitamos los permisos necesarios
ssh-add ~/.ssh/OpenSSH.GitHub # ponemos la contraseña y ya tenemos cargala la clave
|
Si obtenemos este error al cargar la clave con ssh-add OpenSSH
:
1
| Could not open a connection to your authentication agent.
|
Entonces tendremos que ejecutar eval $(ssh-agent)
y colocarlo al final de .bashrc para que se ejecute al inicio de cada sesión.
ssh -T git@github.com
1
2
| Resultado
Hi procamora! You've successfully authenticated, but GitHub does not provide shell access.
|
Para hacer que se auto cargue la clave al inicio de la sesión crear un script como este y ponerlo en el arranque de linux, para descargarlo pulse aquí
1
2
3
4
5
6
7
8
| #!/usr/bin/expect -f
set USER [exec whoami]
spawn ssh-add /home/$USER/.ssh/OpenSSH
expect "Enter passphrase for /home/$USER/.ssh/OpenSSH:"
send "PASSWORD$\n";
interact
|
Fuentes: stackexchange