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

  • SEARCH
  • Home
  • 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 967083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:15:36+00:00 2026-05-16T02:15:36+00:00

Sorry if this has been asked before, I did check but couldn’t find anything…

  • 0

Sorry if this has been asked before, I did check but couldn’t find anything…

Is there a function in Unix to encrypt and decrypt a password in a batch file so that I can pipe it into some other commands in a bash file?

I realise that doing this provides no real security, it is more to stop someone accidentally seeing the password if they are looking at the script over my shoulder 🙂

I’m running on Red Hat 5.3.

I have a script which does something similar to this:

serverControl.sh -u admin -p myPassword -c shutdown

and I would like to do something like this:

password = decrypt("fgsfkageaivgea", "aDecryptionKey")
serverControl.sh -u admin -p $password -c shutdown

This doesn’t protect the password in any way, but does stop someone from accidentally seeing it over my shoulder.

  • 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-05-16T02:15:37+00:00Added an answer on May 16, 2026 at 2:15 am

    OpenSSL provides a passwd command that can encrypt but doesn’t decrypt as it only does hashes. You could also download something like aesutil so you can use a capable and well-known symmetric encryption routine.

    For example:

    #!/bin/sh    
    # using aesutil
    SALT=$(mkrand 15) # mkrand generates a 15-character random passwd
    MYENCPASS="i/b9pkcpQAPy7BzH2JlqHVoJc2mNTBM=" # echo "passwd" | aes -e -b -B -p $SALT 
    MYPASS=$(echo "$MYENCPASS" | aes -d -b -p $SALT)
    
    # and usage
    serverControl.sh -u admin -p $MYPASS -c shutdown
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this has been asked before, I searched but couldn't find anything. I'm
Sorry if this has been asked before, but I couldn't find a good example
I'm sorry if this questions has been asked before, but I couldn't find an
Sorry if this has been asked before, but I couldn't find a solution to
I'm sorry if this has been asked before - but I couldn't find a
I'm sorry if this question has been asked already, but I couldn't find it
Sorry if this has been asked before but I've tried searching and can't find
Sorry if this has been asked before, I can't seem to find anything. I'm
Sorry if this has been asked before, but I can't find a clear enough
Sorry if this has been asked before. I couldn't find a definitive answer. Can

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.