Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

put password in script for ssh ... 1

Status
Not open for further replies.

hokky

Technical User
Nov 9, 2006
170
0
0
AU
Hi guys,

I need a favor here,

I need to ssh accross the other server, but I need to put password in it.

that server can't be passwordless because of the permission thing that I am not allowed to change.

So this is part of my script :
Code:
#!/bin/ksh

ssh dr01 "ls -l" <<EOF
password
EOF

but it doesnt work, any idea guys ?

Thanks very much before.
 
To do file transfers using my system try
Code:
cat /path/to/input/file | sudo su - txuser -c "ssh txuser@server2 \"sudo su - user2 -c \\\"cat > /path/to/output/file\\\"\""
Take care with all the quoted quotes!



Ceci n'est pas une signature
Columb Healy
 
Going back to your original attempt:

Code:
#!/usr/bin/expect

spawn ssh ypprod02 "ls -l"
expect "[COLOR=red]p[/color]assword: "
send "test\r"
[COLOR=red]expect "the unexpected"[/color]

You need to give expect something to do while waiting for the output of the ls -l, otherwise it just terminates too quickly.



Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top