I have a password stored in plaintext. I only want my expect script "LoadList" to be able to read the password in order to spawn an SFTP session. There's no scenario in which I want to be able to read the password. Can this be accomplished somehow by assigning the script to a user, and only giving that user read access?
1 Answer
$ssh-keygen
Accept the default file location then hit return twice to not include a passphrase.
Will generate a file in the home directory/.ssh called id_rsa.pub
then use ssh-copy-id {name of the server you want to connect to} select yes then enter the users password.
This will create a file called authorized_keys in the .ssh directory of the users home directory.
If that fails to create the file, copy the contents of this file to the authorized_keys directory on the destination server - home directory/.ssh/authorized_keys
Test ssh doesn't prompt for a password.
-
I do have access to both servers. Do you have a link to any documentation or sample code on how to implement?– KuboMDNov 15, 2018 at 13:33
-
-
Thanks! The commands worked and the authorized_keys file was generated with content that ended in "user@server", however ssh still asks for a password.– KuboMDNov 15, 2018 at 15:19
-
Try setting it up on both servers and make sure you copy the keys across, may need to do it manually.– GttNov 16, 2018 at 8:33