Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

could anyone please list some options to save a set of credentials somewhere on a server where a bash file could access them? The script needs the credentials to log in to a server and collect data. I'm in a tight spot and need to find a quick solution and I have little experience with scripting. Some ideas I had:

  • Save credentials in a password protected hidden file and reference the variables from the script. However this leaves the credentials open to access if a malicious user has access to the script, right?

  • Somehow encrypting the password, but I have no idea how or how encrypting it would restrict access.

I appreciate any suggestions.

share|improve this question
    
Could you give us some more details? What are these credentials for? How are you using them? –  gronostaj Apr 9 '13 at 13:42

1 Answer 1

up vote 3 down vote accepted

If the server you log in to has ssh, then you should use that. ssh is encrypted, and you can use public/private key credentials to log into your server. If the server doesn't have ssh, well you should bug your sysadmin to install it. It really should.

If not, I'd say store these in a file in the user's home directory, in a file readable only by the user, in a directory readable only by the user. The rest of the script can reside anywhere, but the credentials are thusly locked down. Encryption doesn't buy you much in this situation. If the app has the ability to decrypt the password, then anyone running the app can watch how it's decrypted.

Go with ssh.

share|improve this answer
    
Thanks Rich. I know that the users ssh in to the server so the public/private key solution should work. I will try that out. –  user1810434 Apr 9 '13 at 13:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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