0

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.

nitins
  • 2,579
  • 15
  • 44
  • 68

4 Answers4

2

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).

JanC
  • 398
  • 2
  • 5
  • +½ 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 08:15
1

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.

weeheavy
  • 4,089
  • 1
  • 28
  • 41
0

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.

David Pashley
  • 23,497
  • 2
  • 46
  • 73
0

Found a good solution using GPG

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

nitins
  • 2,579
  • 15
  • 44
  • 68