Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We have a few shell scripts for backup/database dump purpose which have username/password info in them. Is there any way do this other than SHC which appears to be having some issues.

share|improve this question
add comment

4 Answers

Encryption will never help for this on its own, as every user who has to run it also needs to be able to decrypt it.

If you need non-admin users to run a backup script, you should use something like sudo to give them the rights to run that script but not the rights to read the passwords (i.e. make sure the permissions are set such that the user can't read them).

share|improve this answer
    
+½ for pointing out the pitfall, though the solution requires the script to be non-exploitable which usually no software is ^^ –  Oskar Duveborn Sep 17 '10 at 8:15
add comment

I don't know any encryption solution.

But you might consider another approach by filling your login information into a file with appropriate access rights. (MySQL = .my.cnf, PostgresSQL = .pgpass etc).

That way you can avoid encrypting your shell scripts which doesn't sound secure to me anyway.

share|improve this answer
add comment

Do normal users need to be able to run these scripts? Presumably you could have a backup user and set the permissions on the script to 700. If you really needed to let other people to run the script you could use sudo. You have very little chance of hiding the passwords from the root user.

share|improve this answer
add comment
up vote 0 down vote accepted

Found a good solution using GPG

http://ubuntuforums.org/showthread.php?t=396591&page=2

share|improve this answer
1  
How is that secure? Where and how do you store the key? –  Oskar Duveborn Sep 17 '10 at 8:13
    
I read that post and they do point out the weakness. –  Allen Aug 22 '11 at 0:26
add comment

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.