Ho eseguito ssh-keygen
su OS X e quando ho visualizzato la chiave pubblica generata, ho visto che il mio login e il nome della macchina appaiono nell'ultima parte della chiave. C'è un modo per usarlo con un valore diverso o non usarlo affatto?Come mantenere ssh-keygen dall'utilizzo del nome di accesso e del computer nella chiave pubblica?
18
A
risposta
23
Dalla pagina man ‘ssh-keygen (1)’:
For RSA1 keys, there is also a comment field in the key file that is only for convenience to the user to help identify the key. The comment can tell what the key is for, or whatever is useful. The comment is initialized to “[email protected]” when the key is created, but can be changed using the -c option. … -C comment Provides a new comment. -c Requests changing the comment in the private and public key files. This operation is only supported for RSA1 keys. The program will prompt for the file containing the private keys, for the passphrase if the key has one, and for the new comment.
Così, quando si crea la chiave si utilizza -C "$desiredcommenttext"
per fornire qualsiasi testo di commento che ti piace; o per una chiave esistente, utilizzare l'opzione -c
per modificare il commento.
6
Sì! Non è affatto necessario, è solo arbitrariamente aggiunto per rendere più facile per te ricordare da dove proviene. Se si desidera modificare, basta aprire una sessione di terminale e digitare:
$ nano ~/.ssh/id_rsa.pub
Rimuovere la parte terminale della linea (dopo il doppio-pari).
Invece di hackerare direttamente il file di dati (che è fragile poiché potrebbe cambiare), meglio usare l'interfaccia utente dello strumento ufficiale per questo scopo. – bignose
@bignose Ciò presupporrebbe conoscere il comando corretto non è vero? – Nuzzolilo