Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: exec, echo and pipe

by morgon (Priest)
on Apr 01, 2016 at 17:51 UTC ( #1159315=note: print w/replies, xml ) Need Help??


in reply to exec, echo and pipe

handle this password passing
I would simply pass it via the environment, eg

exec "MY_PASSWORD=$Captured_Password ./processor.pl -j $Trigger_Job -u $Captured_User_Name > /dev/null 2>&1 &"

Your processor.pl then simply grabs the password with $ENV{MY_PASSWORD}.

Replies are listed 'Best First'.
Re^2: exec, echo and pipe
by afoken (Canon) on Apr 02, 2016 at 20:54 UTC
    I would simply pass it via the environment

    Both command line and environment can be read by other users on the system (using tools like ps, pstree, top), so both are not the best place to pass a password around. Passing the password through a pipe prevents that.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      Can you read the environment via ps, pstree or top?

      If so how?

      The only way I know (on Linux) is via /proc.

        Can you read the environment via ps, pstree or top?

        If so how?

        The only way I know (on Linux) is via /proc.

        ps has an "e" flag:

        /home/alex>env - PASSWORD=SECRET sleep 100 & [1] 30765 /home/alex>ps e PID TTY STAT TIME COMMAND 1749 pts/1 Ss 0:00 -bash USER=alex LOGNAME=alex HOME=/home/ale +x PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin M +AIL=/var/mail/alex 5580 pts/1 R+ 0:00 ps e CPLUS_INCLUDE_PATH=/usr/lib64/qt/inclu +de MANPATH=/usr/local/man:/usr/man:/usr/lib64/java/man:/opt/bincimap/ +man:/opt/swish-e/ma 30765 pts/1 S 0:00 sleep 100 PASSWORD=SECRET /home/alex>ps --version procps version 3.2.8 /home/alex>

        pstree and top can show command line arguments (using pstree -a), but they can't list the environment.

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1159315]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2019-10-24 04:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?