RE: ssh in bash script

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

 



Two things come to mind: First a passwordless key pair and second a key with
a password in conjunction with the ssh-keyagent. You can find information
about generating key pairs and their setup in the man page and ssh
documentation. If you are looking for a programming solution I dont know
enough to help.

> -----Original Message-----
> From: redhat-list-admin@xxxxxxxxxx
> [mailto:redhat-list-admin@xxxxxxxxxx]On Behalf Of Ali Jonathan Nabavi
> Sent: Saturday, October 25, 2003 1:31 PM
> To: redhat-list@xxxxxxxxxx
> Subject: ssh in bash script
>
>
> Hey, folks.
>
> Here's my bash script:
> *********************************
>
> #!/bin/bash
>
> mysqldump -hlocalhost -uusername -ppassword --add-drop-table dbname
> table1 table2 table3 | ssh -2 username@xxxxxxxx mysql -hlocalhost
> -uusername -ppasword dbname;
>
> echo "mysql -hlocalhost -uusername -ppassword -e\"use dbname; drop table
> table1; alter table qs9000 rename qs9000_subscribers; create table
> qs9000 select * from qs9000_subscribers; alter table qs9000 modify id
> bigint not null auto_increment, add primary key (id), add index
> (Country,State,ISONum,Version,Reginfo2); SELECT  * FROM  table1 ORDER
> BY  Add1  ASC\" qsu > '/usr/local/www/filename.txt'; zip -9D
> '/usr/local/www/filename.zip' '/usr/local/www/filename.txt';" | ssh -2
> username@xxxxxxxx;
>
> *********************************
> It works just fine, however I am forced to enter my ssh password twice.
> I am wondering if there is a way to do this without having to enter my
> password multiple times.
>
> The things I've considered but don't have the know-how to implement
> right now are piping commands differently or reusing the same SSH
> channel, referring to it with SSH_AUTH_SOCK or something like that.
>
> Thanks a lot for reading.
>
>
> -Ali
>
>
>
>
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>



-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux