Find the answer to your Linux question:
Results 1 to 3 of 3
Linux newbie needs to know how he can securely pass a password to a shell script (so the password doesn't have to show in the clear in the script)? This ...
  1. #1
    Just Joined!
    Join Date
    Jun 2009
    Posts
    11

    Secure Password to Shell Script

    Linux newbie needs to know how he can securely pass a password to a shell script (so the password doesn't have to show in the clear in the script)? This is a script which will run as a cron job.

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    Well, you cannot pass it in on the commandline, obviously.

    One possibility might be to put your password into a file and have the script read that file. By making the owner of the password file the same user as the person running the script and giving the password file permissions 400, only that user will be able to read the file.

    Of course, my immediate question is then to ask why you need this password? What are you doing that requires a password?
    DISTRO=Arch
    Registered Linux User #388732

  3. #3
    Just Joined!
    Join Date
    Jun 2009
    Posts
    11
    Creating a dump.sh script to daily (nightly) dump two databases via mysqldump.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...