[CentOS] echo password into bash script

Tue Aug 25 20:14:11 UTC 2015
Tim Dunphy <bluethundr at gmail.com>

>
> 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 at 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 at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>



-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B