I know it's recommended to use ssh keygen to login without password, but find it scary that if someone gets access to my computer in any way, they have the possibility to login to all servers with the stored keys.
So I was thinking of obscuring the process a bit, by setting a password on the identity file, and having a script use a randomized incredible long and hard passphrase to input in plain text to ssh login.
So far, I have generated a ssh-keygen like so, and copied the content of .pub to the server like so:
❯ ssh-keygen -t ed25519
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/username/.ssh/id_ed25519): testssh
Enter passphrase (empty for no passphrase): <-- This is NOT empty
Enter same passphrase again: <-- This is NOT empty
Your identification has been saved in testssh
Your public key has been saved in testssh.pub
The key fingerprint is:
❯ cat ~/testssh.pub | ssh [email protected] 'cat >> .ssh/authorized_keys'
[email protected]'s password:
Right now, it will ask for the password to the key like so:
❯ ssh -i testssh [email protected]
Enter passphrase for key 'testssh':
But I want to know if something like this is possible:
❯ ssh -i testssh --passphrase="SomeIncredibleLongAndRandomizedPasswordThatIsMeantToBeUsedForScripts" [email protected]
So the question is, how do I login using identity file with the password as a argument?
I hope I'm getting my point clear