Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8899743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:55:55+00:00 2026-06-15T00:55:55+00:00

I have a bash script which uses a text file containing a list of

  • 0

I have a bash script which uses a text file containing a list of logins:

LOGINLIST=/home/user/logins.txt
while read line
do
echo $line
done < $LOGINLIST

I’d rather not store the list of logins as plain text, but I don’t want to have to manually decrypt it every time time I run the script. (Having the script prompt for a password would be OK.)

One way I could do this would be to include a line in the script where e.g openssl decrypts the file before it gets read. Unfortunately, if the script stalled (perhaps one of the sites it’s logging in to isn’t responding) this would leave the file unprotected for an indeterminate period of time.

So I’d rather keep the plaintext in memory only.

This post on LinuxQuestions ( http://www.linuxquestions.org/questions/programming-9/can-we-hide-the-code-of-a-shell-script-370328/#post1887648 ) suggests that sending the plaintext to a FIFO might do the trick, but that’s wholly unfamiliar territory for me. Is there a better / simpler way? How do I wipe the memory when the script is done?

…and is there a way to edit the encrypted login list while also keeping the plaintext in memory?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T00:55:56+00:00Added an answer on June 15, 2026 at 12:55 am

    You can do that with openssl and process substitution without changing the structure of your code.

    To encrypt the file, use something like:

    openssl blowfish -in plaint_text_file -out encrytped_file
    

    (Choose the cipher you want, it will prompt you for a password.)

    Then you can use the encrypted file with:

    LOGINLIST=/path/to/encrypted/file
    while read line
    do
      echo $line
    done < <(openssl blowfish -d -in $LOGINLIST)
    

    This will prompt you for the password. No temporary file generated.

    (Careful with the spaces in the last command, it really is < <(.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a shell script testShell.sh which uses getopts as below: #!/bin/bash while getopts
I have this bash script which pases a text file and I would like
I have a script in bash which uses the HTK toolkit . One of
I have a bash script which I wrote that lists out some servers/user names.
I have a bash script which prompts for user input multiple times and processes
I have a form which uses $.ajax on submit to call a bash script
I have a bash script file which starts with a function definition, like this:
I have a bash script which need to execute some php scripts and to
Currently I have a bash script which runs the find command, like so: find
I have written a bash script which installs a number of packages, however for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.