D
DKljuikov
Guest
Hello!
Im trying to write script wich will be send public ssh key to several hosts. And these actions should be executed without entering password.
i.e. i need something like:
>>>
/usr/bin/expect -c 'eval spawn {cat ~/.ssh/id_rsa.pub | ssh ftj_dklj@oracle "mkdir -p ~/.ssh && cat - >> ~/.ssh/authorized_keys"}
expect "assword:"
send "*****\n"
expect eof'
<<<
I know that pipe is not allowed in expect. Example above is just for understanding what i want) Also i've tried at least create .ssh directory. But these actions also were not successfull.
Code:
>>>
expect -c 'spawn ssh ftj_dklj@oracle
expect "assword:"{
send "****\n"
}
expect "login"{
send "mkdir -p ~/.ssh\n"
}
'
<<<
platform -
Linux oracle.test.fts 2.6.9-55.0.0.0.2.ELhugemem #1 SMP Wed May 2 15:04:06 PDT 2007 i686 i686 i386 GNU/Linux
Could u please advise what im doing wrong?
Thx, Denis
Im trying to write script wich will be send public ssh key to several hosts. And these actions should be executed without entering password.
i.e. i need something like:
>>>
/usr/bin/expect -c 'eval spawn {cat ~/.ssh/id_rsa.pub | ssh ftj_dklj@oracle "mkdir -p ~/.ssh && cat - >> ~/.ssh/authorized_keys"}
expect "assword:"
send "*****\n"
expect eof'
<<<
I know that pipe is not allowed in expect. Example above is just for understanding what i want) Also i've tried at least create .ssh directory. But these actions also were not successfull.
Code:
>>>
expect -c 'spawn ssh ftj_dklj@oracle
expect "assword:"{
send "****\n"
}
expect "login"{
send "mkdir -p ~/.ssh\n"
}
'
<<<
platform -
Linux oracle.test.fts 2.6.9-55.0.0.0.2.ELhugemem #1 SMP Wed May 2 15:04:06 PDT 2007 i686 i686 i386 GNU/Linux
Could u please advise what im doing wrong?
Thx, Denis
Last edited: