<p>The Linux I have in this container is as shown below:</p>

<pre><code>root@sbolla-6c7b7589d8-5c2rb:/usr/safenet/lunaclient# uname -a
Linux sbolla-6c7b7589d8-5c2rb 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017 x86_64 GNU/Linux
root@sbolla-6c7b7589d8-5c2rb:/usr/safenet/lunaclient#
</code></pre>

<p>I am trying to do a simple scp with sshpass command as shown below and running into this error. any ideas really appreciated. Please note that I have tried scp and not cp. Infact this line is in a script, I tried it on the linux command line I got this error. I have also tried escaping the Environment variables with ' and " and \ and all combos, but that doesn't seem to have helped.</p>

<pre><code>root@sbolla-6c7b7589d8-5c2rb:/usr/safenet/lunaclient/bin# sshpass -p '$H_PASSWORD' scp -v  $H_USERNAME@$H_HOSTNAME:server.pem .
Executing: cp '--' 'admin@abc-def.brilliant.local' '.'
cp: cannot stat 'admin@abc-def.brilliant.local': No such file or directory
Executing: cp '--' ':server.pem' '.'
cp: cannot stat ':server.pem': No such file or directory
root@sbolla-6c7b7589d8-5c2rb:/usr/safenet/lunaclient/bin#
</code></pre>

<p>If I explicitly use this command i got it to work, not sure why. Please not that hostname in these outputs have been edited to some goofy names</p>

<pre><code>root@sbolla-6c7b7589d8-5c2rb:/usr/safenet/lunaclient#   sshpass -p $HSM_PASSWORD scp admin@grs-defcon.brilliant.local:server.pem .

ls -lia 
root@sbolla-6c7b7589d8-5c2rb:/usr/safenet/lunaclient# ls -l | grep ser
-rw-r--r-- 1 root root 1172 Apr 28 12:23 server.pem
root@sbolla-6c7b7589d8-5c2rb:/usr/safenet/lunaclient# date
Sat Apr 28 12:24:29 UTC 2018
root@sbolla-6c7b7589d8-5c2rb:/usr/safenet/lunaclient#
</code></pre>

<p>I have tried the answer provided below but didn't work</p>

<pre><code>sshpass -p "$H_PASSWORD" scp -v $H_USERNAME@${H_HOSTNAME}:server.pem .
</code></pre>

<p>another thing I have noticed is if I do the env on this container, I see an extra line in the environment variable , could that be an issue. See how this env shows. Note that I have not entered a line on purpose, when I type env command I see line next to the H_HOSTNAME and the H_PARTITION which is weird 
    H_PARTITION=Operator</p>

<pre><code>MYSQL_PORT=tcp://11.123.113.242:3306
LUNAHS=TRUE
H_HOSTNAME=grs-defcon.brilliant.local

ROOT_PORT_443_TCP_PORT=443
MYSQL_PORT_3306_TCP_ADDR=11.456.231.242
</code></pre>

<p>Looks like 2 shell expansion issues. Try:</p>

<pre><code>sshpass -p "$H_PASSWORD" scp -v $H_USERNAME@${H_HOSTNAME}:server.pem .
</code></pre>
