Skip to main content
  1. Don't reinvent the wheel

    There could already exist some tool for doing what you need.

  2. Check your history files

    grep mycommand .*history
    
  3. Don't use command line arguments or environment variables to store sensible datassensitive data (like passwordpasswords)!

    Always use files or fd (file descriptors)! Try

    ps axefwww
    

    to read all command lines and environment, currently running on your host

  1. Don't reinvent the wheel

    There could already exist some tool for doing what you need.

  2. Check your history files

    grep mycommand .*history
    
  3. Don't use command line arguments or environment variables to store sensible datas (like password)!

    Always use files or fd (file descriptors)! Try

    ps axefwww
    

    to read all command lines and environment, currently running on your host

  1. Don't reinvent the wheel

    There could already exist some tool for doing what you need.

  2. Check your history files

    grep mycommand .*history
    
  3. Don't use command line arguments or environment variables to store sensitive data (like passwords)!

    Always use files or fd (file descriptors)! Try

    ps axefwww
    

    to read all command lines and environment, currently running on your host

added 601 characters in body
Source Link
  1. Don't reinvent the wheel

    There could already exist some tool for doing what you need.

  2. Check your history files

    grep mycommand .*history
    
  3. Don't use command line arguments or environment variables to store sensible datas (like password)!

    Always use files or fd (file descriptors)! Try

    ps axefwww
    

    to read all command lines and environment, currently running on your host

#!/bin/sh

umask 077
TEMPDIR=$(mktemp -d -p $HOME"$HOME" .secretXXXXXXXX)
trap "rm -fR $TEMPDIR;exit"'$TEMPDIR';exit" 0 1 2 3 6 9 15
[ "$TEMPDIR" ] || exit 1
cd $TEMPDIR"$TEMPDIR" || exit 1

ostty=$(stty -g)
stty -echo

printf "\nEnter password: "
head -n1 >pass1

printf "\nRe-enter password: "
head -n1 >pass2

stty $ostty
echo

chk1=$(sha1sum <pass1)
chk2=$(sha1sum <pass2)

[ "$chk1" = "$chk2" ] || {
    echo "password doesn't match"
    exit 1
}

openssl DoSomeThingWith -passin file:pass1
  1. Don't reinvent the wheel

    There could already exist some tool for doing what you need.

  2. Check your history files

    grep mycommand .*history
    
  3. Don't use command line arguments or environment variables to store sensible datas (like password)!

    Always use fd (file descriptors)! Try

    ps axefwww
    

    to read all command lines and environment, currently running on your host

#!/bin/sh

umask 077
TEMPDIR=$(mktemp -d -p $HOME .secretXXXXXXXX)
trap "rm -fR $TEMPDIR;exit" 0 1 2 3 6 9 15
[ "$TEMPDIR" ] || exit 1
cd $TEMPDIR || exit 1

ostty=$(stty -g)
stty -echo

printf "\nEnter password: "
head -n1 >pass1

printf "\nRe-enter password: "
head -n1 >pass2

stty $ostty
echo

chk1=$(sha1sum <pass1)
chk2=$(sha1sum <pass2)

[ "$chk1" = "$chk2" ] || {
    echo "password doesn't match"
    exit 1
}

openssl DoSomeThingWith -passin file:pass1
  1. Don't reinvent the wheel

    There could already exist some tool for doing what you need.

  2. Check your history files

    grep mycommand .*history
    
  3. Don't use command line arguments or environment variables to store sensible datas (like password)!

    Always use files or fd (file descriptors)! Try

    ps axefwww
    

    to read all command lines and environment, currently running on your host

#!/bin/sh

umask 077
TEMPDIR=$(mktemp -d -p "$HOME" .secretXXXXXXXX)
trap "rm -fR '$TEMPDIR';exit" 0 1 2 3 6 9 15
[ "$TEMPDIR" ] || exit 1
cd "$TEMPDIR" || exit 1

ostty=$(stty -g)
stty -echo

printf "\nEnter password: "
head -n1 >pass1

printf "\nRe-enter password: "
head -n1 >pass2

stty $ostty
echo

chk1=$(sha1sum <pass1)
chk2=$(sha1sum <pass2)

[ "$chk1" = "$chk2" ] || {
    echo "password doesn't match"
    exit 1
}

openssl DoSomeThingWith -passin file:pass1
added 601 characters in body
Source Link

Introduction

Little sample

#!/bin/sh

umask 077
TEMPDIR=$(mktemp -d -p $HOME .secretXXXXXXXX)
trap "rm -fR $TEMPDIR;exit" 0 1 2 3 6 9 15
[ "$TEMPDIR" ] || exit 1
cd $TEMPDIR || exit 1

ostty=$(stty -g)
stty -echo

printf "\nEnter password: "
head -n1 >pass1

printf "\nRe-enter password: "
head -n1 >pass2

stty $ostty
echo

chk1=$(sha1sum <pass1)
chk2=$(sha1sum <pass2)

[ "$chk1" = "$chk2" ] || {
    echo "password doesn't match"
    exit 1
}

openssl DoSomeThingWith -passin file:pass1

Introduction

Little sample

#!/bin/sh

umask 077
TEMPDIR=$(mktemp -d -p $HOME .secretXXXXXXXX)
trap "rm -fR $TEMPDIR;exit" 0 1 2 3 6 9 15
[ "$TEMPDIR" ] || exit 1
cd $TEMPDIR || exit 1

ostty=$(stty -g)
stty -echo

printf "\nEnter password: "
head -n1 >pass1

printf "\nRe-enter password: "
head -n1 >pass2

stty $ostty
echo

chk1=$(sha1sum <pass1)
chk2=$(sha1sum <pass2)

[ "$chk1" = "$chk2" ] || {
    echo "password doesn't match"
    exit 1
}

openssl DoSomeThingWith -passin file:pass1
added 2047 characters in body
Source Link
Loading
Source Link
Loading