Hey guys,
I'm trying to echo my password into some commands inside of a bash script. But I think I'm going about it incorrectly.
Here's the top part of my script:
#!/bin/bash pub="~/.ssh/id_rsa.pub" dps_pass="my_pass" ssh="/usr/bin/ssh" scp="/usr/bin/scp" for i in 10.10.10.2{5,6} do echo "xfring key up" echo $dps_pass | $scp $PUB digitalplatform@$i:
And here's how it executes:
#bash -x deploy_key.sh + pub='~/.ssh/id_rsa.pub' + dps_pass='nbcuV01P!' + ssh=/usr/bin/ssh + scp=/usr/bin/scp + for i in 10.10.10.2{5.6} + echo 'xfring key up' xfring key up + echo 'my_pass' + /usr/bin/scp /Users/my_user/.ssh/id_rsa.pub digitalplatform@10.10.10.25: Password:
Can someone please let me know where I'm going wrong?
Thanks Tim
Use expect?
Eero 25.8.2015 7.52 ip. "Tim Dunphy" bluethundr@gmail.com kirjoitti:
Hey guys,
I'm trying to echo my password into some commands inside of a bash script. But I think I'm going about it incorrectly.
Here's the top part of my script:
#!/bin/bash pub="~/.ssh/id_rsa.pub" dps_pass="my_pass" ssh="/usr/bin/ssh" scp="/usr/bin/scp" for i in 10.10.10.2{5,6} do echo "xfring key up" echo $dps_pass | $scp $PUB digitalplatform@$i:
And here's how it executes:
#bash -x deploy_key.sh
- pub='~/.ssh/id_rsa.pub'
- dps_pass='nbcuV01P!'
- ssh=/usr/bin/ssh
- scp=/usr/bin/scp
- for i in 10.10.10.2{5.6}
- echo 'xfring key up'
xfring key up
- echo 'my_pass'
- /usr/bin/scp /Users/my_user/.ssh/id_rsa.pub digitalplatform@10.10.10.25:
Password:
Can someone please let me know where I'm going wrong?
Thanks Tim -- GPG me!!
gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Use expect?
yep! Expect should work.
Thanks
On Tue, Aug 25, 2015 at 12:56 PM, Eero Volotinen eero.volotinen@iki.fi wrote:
Use expect?
Eero 25.8.2015 7.52 ip. "Tim Dunphy" bluethundr@gmail.com kirjoitti:
Hey guys,
I'm trying to echo my password into some commands inside of a bash
script.
But I think I'm going about it incorrectly.
Here's the top part of my script:
#!/bin/bash pub="~/.ssh/id_rsa.pub" dps_pass="my_pass" ssh="/usr/bin/ssh" scp="/usr/bin/scp" for i in 10.10.10.2{5,6} do echo "xfring key up" echo $dps_pass | $scp $PUB digitalplatform@$i:
And here's how it executes:
#bash -x deploy_key.sh
- pub='~/.ssh/id_rsa.pub'
- dps_pass='nbcuV01P!'
- ssh=/usr/bin/ssh
- scp=/usr/bin/scp
- for i in 10.10.10.2{5.6}
- echo 'xfring key up'
xfring key up
- echo 'my_pass'
- /usr/bin/scp /Users/my_user/.ssh/id_rsa.pub
digitalplatform@10.10.10.25:
Password:
Can someone please let me know where I'm going wrong?
Thanks Tim -- GPG me!!
gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On 08/25/2015 12:51 PM, Tim Dunphy wrote:
Hey guys,
I'm trying to echo my password into some commands inside of a bash script. But I think I'm going about it incorrectly.
Here's the top part of my script:
#!/bin/bash pub="~/.ssh/id_rsa.pub" dps_pass="my_pass" ssh="/usr/bin/ssh" scp="/usr/bin/scp" for i in 10.10.10.2{5,6} do echo "xfring key up" echo $dps_pass | $scp $PUB digitalplatform@$i:
And here's how it executes:
#bash -x deploy_key.sh
- pub='~/.ssh/id_rsa.pub'
<removed> + ssh=/usr/bin/ssh + scp=/usr/bin/scp + for i in 10.10.10.2{5.6} + echo 'xfring key up' xfring key up + echo 'my_pass' + /usr/bin/scp /Users/my_user/.ssh/id_rsa.pub digitalplatform@10.10.10.25: Password:
Can someone please let me know where I'm going wrong?
Thanks Tim
I don't think you can have utilities like ssh/scp take in passwd from an echo on the command line. I'd also suggest you change your password(s) based on the <removed> line above ... from your original email.
if you really want to do something like this, I'd suggest expect as the scripting language.
What are you trying to do? Copy your public key out to use it for future authentication? Use ssh-copy-id to set it up the first time? Or look at the package sshpass.
On Tue, Aug 25, 2015 at 12:58 PM, zep zgreenfelder@gmail.com wrote:
On 08/25/2015 12:51 PM, Tim Dunphy wrote:
Hey guys,
I'm trying to echo my password into some commands inside of a bash
script.
But I think I'm going about it incorrectly.
Here's the top part of my script:
#!/bin/bash pub="~/.ssh/id_rsa.pub" dps_pass="my_pass" ssh="/usr/bin/ssh" scp="/usr/bin/scp" for i in 10.10.10.2{5,6} do echo "xfring key up" echo $dps_pass | $scp $PUB digitalplatform@$i:
And here's how it executes:
#bash -x deploy_key.sh
- pub='~/.ssh/id_rsa.pub'
<removed> + ssh=/usr/bin/ssh + scp=/usr/bin/scp + for i in 10.10.10.2{5.6} + echo 'xfring key up' xfring key up + echo 'my_pass' + /usr/bin/scp /Users/my_user/.ssh/id_rsa.pub
digitalplatform@10.10.10.25:
Password:
Can someone please let me know where I'm going wrong?
Thanks Tim
I don't think you can have utilities like ssh/scp take in passwd from an echo on the command line. I'd also suggest you change your password(s) based on the <removed> line above ... from your original email.
if you really want to do something like this, I'd suggest expect as the scripting language.
-- public gpg key id: AE60F64C
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On 08/26/2015 04:51 AM, Tim Dunphy wrote:
Hey guys,
I'm trying to echo my password into some commands inside of a bash script. But I think I'm going about it incorrectly.
Here's the top part of my script:
#!/bin/bash pub="~/.ssh/id_rsa.pub" dps_pass="my_pass" ssh="/usr/bin/ssh" scp="/usr/bin/scp" for i in 10.10.10.2{5,6} do echo "xfring key up" echo $dps_pass | $scp $PUB digitalplatform@$i:
Don't try to automate your password like this for scp or other ssh-related apps. Generate and use a public/private keypair instead and your script will then be able to connect without prompting for a password.
Peter
Don't try to automate your password like this for scp or other ssh-related apps. Generate and use a public/private keypair instead and your script will then be able to connect without prompting for a password.
Well, look at the lines in my script that I'm showing here. That's exactly what I'm doing. Copying up my public key so that later in the script (which I didn't show, no need to I think) is to cat the public key into place and make sure there are proper permissions etc on the .ssh directory on the remote machine.
But Eero and other are right.. I'll be much better off using expect to get this type of work done. It's jut that I'm more familiar with bash so I thought that there might be a good way to do it with that also.
On Tue, Aug 25, 2015 at 4:04 PM, Peter peter@pajamian.dhs.org wrote:
On 08/26/2015 04:51 AM, Tim Dunphy wrote:
Hey guys,
I'm trying to echo my password into some commands inside of a bash
script.
But I think I'm going about it incorrectly.
Here's the top part of my script:
#!/bin/bash pub="~/.ssh/id_rsa.pub" dps_pass="my_pass" ssh="/usr/bin/ssh" scp="/usr/bin/scp" for i in 10.10.10.2{5,6} do echo "xfring key up" echo $dps_pass | $scp $PUB digitalplatform@$i:
Don't try to automate your password like this for scp or other ssh-related apps. Generate and use a public/private keypair instead and your script will then be able to connect without prompting for a password.
Peter _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On 08/26/2015 08:14 AM, Tim Dunphy wrote:
Well, look at the lines in my script that I'm showing here. That's exactly what I'm doing. Copying up my public key so that later in the script (which I didn't show, no need to I think) is to cat the public key into place and make sure there are proper permissions etc on the .ssh directory on the remote machine.
So you're re-inventing ssh-copy-id?
Peter