0

Is it safe and secure to save username and password in a batch file and use it to connect to putty ? Batch file contains below command:

start putty -ssh -load session -l username -pw password    
0

Storing plain text passwords is never safe, generally speaking.

Given that, it's your job to determine how sensible this data is and find a good compromise between security and comfort.

0

NO

If a malicious user gains access to your machine, they can view the batch file just like a plain text file and get your username and password. Assuming that you are either putting the batch file in an easily accessible place (such as your desktop) or inside a directory in the PATH variable, it won't be hard to find if someone wants to.

If you write the batch script, it is best practice to still have it prompt you for your password.

You may be able to hide your password in an alternate data stream, as shown here. But I must caveat that by saying that it's still not secure. Batch scripting is simply a way for your shell to automatically run commands that you have pre-written. It can't be encrypted or obfuscated. Additionally, the script must be able to read the password in plain text in order to use it in your command.

If you are adamant about automating your workflow for things that require entering passwords, one of your better options may be to use a compiled language such as C.

  • But what I need is to prevent putty prompting me for a password which I provided through batch file. I want to automate the process. Can you please suggest a way to secure my batch file or password ? – learner1 Feb 12 '16 at 13:09
  • I edited my answer to include a link for you to check out. – Lutefisk Feb 12 '16 at 13:19
  • Thanks @Lutefisk. As I cannot compromise on security, I will choose alternative way. – learner1 Feb 15 '16 at 7:32

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.