Re: echo password into bash script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux