& being parsed in command argument

From: Stephen Lawrence Jr. (slawrence_at_ucdavis.edu)
Date: 05/21/03

  • Next message: Michael Robokoff: "chroot"
    Date: Wed, 21 May 2003 13:15:29 -0700
    To: secureshell@securityfocus.com
    
    

    Hello, I have a problem with an ssh command and was hoping for some help.

    The bash script I have does the following:

    1) It builds a $cmdline variable out of some text and the $@ variable: ex

    $@ may be set to something like this:

    "RP_HEADER='Acnt GH&002, period 08, and fiscial year 2001'"

    then:

    cmdline='source /etc/profile;cd
    '$pwd_dir';/u01/app/oracle/product/7.3.4/bin/r25runm '"$@"

    2) It then calls ssh, passing it a host and $cmdline arguemt: ex.

    ssh -n oracle $cmdline

    This method normally works fine, but every once in a while, the $@
    variable comes with an "&" in it (like the example above), and as it is
    being passed to ssh, the script errors out before it gets to the remote
    host because it is capturing the & as a bash signal to background.

    Does anyone have any ideas on what I could do to fix this? Is is a
    quoting issue with the script?

    -- 
    Stephen Lawrence Jr. - Programmer II
    slawrence@ucdavis.edu
    California Animal Health & Food Safety Laboratory System, UC Davis 
    (530)-752-4614
    

  • Next message: Michael Robokoff: "chroot"

    Relevant Pages

    • Re: pppd pty equivilent in FBSD
      ... I let pppd manage retries & setting routes. ... >I wouldn't personally recommend vpn over ssh for anyone either, ... I'm the sole bsd user at my company, and the ppp over ssh ... >Actual bash script I call: ...
      (freebsd-net)
    • Re: [kde-linux] Sessions names
      ... ssh 192.168.2.80??? ... You can write a wrapper script that would start ssh to some ip and rename the ... konsole session dynamically. ... dcop call to konsole you need to know the pid of konsole. ...
      (KDE)
    • Re: Hacker activity?
      ... >login to a server, most as root but some are attempts to login to ... >telnet, all come from the same remote server, and all fail. ... >getting some odd cgi calls to a script on a secure ssl server. ... Make sure root cannot login to your system via ssh. ...
      (freebsd-questions)
    • Re: Ive been hacked...tips for a postmortem?
      ... > for keywords, like the email address in the `mailme' script, see if it ... www.openssh.com) That SSH1 is not to be used for anything other than ... SSH at all. ... an SSH vulnerability is to place in your startup scripts (usually rc.M, ...
      (comp.os.linux.security)
    • RE: SSH Connection
      ... Thank you Stephen, Marshall, Marin, Will and Wayne. ... Subject: SSH Connection ... > script there, then returns to complete the original script. ... > Database Administrator ...
      (RedHat)