1

Credentials in the form of SSH keys can be stored in memory using SSH Agent; However, if clicking the wrong link, or running a malicious program they can also be snatched from memory amd sent somewhere else; which is why ssh-add offers the -t option to specify how long keys will be kept in memory before one is required to reload them hopfully using a passphrase.

Powershell has simalar functionality using secure strimgs but we are discoraged from using it, especially when writing credentials to disk; but Powershell offers another option in which you can prompt a user for their username and password, store it in a variable that will last the length of the powershell session: https://stackoverflow.com/questions/47069785/use-encrypted-password-for-plink-putty

Is it possible to unload credentials gathered from Get-Credentials from memory after a set period of time, similar to ssh-add?

  • What if I use a timers.timer / action to clear the variable storing the Credentials? – leeand00 Apr 24 '18 at 4:04
  • Then I would be storing the credentials in memory, but after a specified period of time, the action could run something like Clear-Variable on the credentials input from the prompt, and then if somebody got into my Powershell session after the timeout they wouldn't find the variable. – leeand00 Apr 24 '18 at 4:06
  • There's a timer example here: jrich523.wordpress.com/2011/06/13/… – leeand00 Apr 24 '18 at 4:07

Your Answer

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

Browse other questions tagged or ask your own question.