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?



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? – KuboMD Nov 15 '18 at 13:33
  • Updated original – Gtt Nov 15 '18 at 15:07
  • 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. – KuboMD Nov 15 '18 at 15:19
  • Try setting it up on both servers and make sure you copy the keys across, may need to do it manually. – Gtt Nov 16 '18 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.