net wrote: > yup sshpass nya error compile > > harus memanfaatkan resource yang ada om :p > > hum kondisi dengan { > > bisa di coba nih > > tapi mau nanya tentang > exec expect -f "$0" ${1+"$@"} <-- untuk $0 itu kan argumen 0 yah > maksud nya kalo lanjutan nya apa.. ? > > spawn ssh [lindex $argv 0] [lindex $argv 1] > > kalo jalanin nya kaya gini cekssh.sh mylo...@myserver.com "ls -al" > > mylogin itu bukan nya argumen 1 > > tapi kalo saya rubah jadi > exec expect -f "$1" ${2+"$@"} <-- malah gabisa > spawn ssh [lindex $argv 1] [lindex $argv 2] > > hehe
Tolong bottom-reply, biar kelihatan urutan diskusinya. $0 adalah argumen ke-0, yaitu nama script atau aplikasi ssh u...@server $0 = ssh $1 = u...@server > > On 3/5/09, Yohanes Nugroho <yoha...@gmail.com> wrote: >> 2009/3/5 net <netzerosp...@gmail.com>: >>> wups bisa om pake expect tapi kok script yang di atas ga jalan yah >>> >>> sementara saya masih pake yang bawah ini (walaupun sebenernya saya >>> maunya pk script yang diatas soalnya bisa saya gabung dengan while >>> untuk membaca list server dari text file) >>> >>> dan masih bermasalah ketika belum tercantum di known host.. (expect >>> biga gak pake if ?? ) >>> >>> ada ide.. ?? >> Tetep kepengen expect ya? >> >> #!/usr/bin/expect >> spawn ssh ocr...@10.146.59.26 >> expect { >> "(yes/no)?" { >> send "yes\r" >> exp_continue >> } "Password:" { >> send "p...@ssw0rd\r" >> } >> } >> send "ls -l\r" >> expect eof >> >> >> >> >>> #!/usr/bin/expect >>> spawn ssh ocr...@10.146.59.26 >>> # SSH confirmation >>> #expect "(yes/no)?" >>> #send "yes\r" >>> expect Password: >>> send "p...@ssw0rd\r" >>> send "ls -l\r" >>> expect eof >>> >>> >>> On 3/2/09, Dani Firman Syah <xnu...@yahoo.com> wrote: >>>> Saya coba bantu, silahkan ketik kode berikut, sebut saja namanya >>>> cekssh.sh >>>> >>>> #!/bin/sh >>>> # \ >>>> exec expect -f "$0" ${1+"$@"} >>>> set password ISIPASSWORDSSH >>>> spawn ssh [lindex $argv 0] [lindex $argv 1] >>>> sleep 1 >>>> # SSH confirmation >>>> #expect "(yes/no)?" >>>> #send "yes\r" >>>> expect "assword:" >>>> send "$password\r" >>>> expect eof >>>> >>>> Jalankan scriptnya dengan sintaks sbb: >>>> >>>> cekssh.sh [u...@host] [command] >>>> >>>> Contoh: cekssh.sh mylo...@myserver.com "ls -al" >>>> >>>> regards, >>>> DNF >>>> >>>> >>>> --- Pada Kam, 26/2/09, net <netzerosp...@gmail.com> menulis: >>>> >>>>> Dari: net <netzerosp...@gmail.com> >>>>> Topik: Re: [linux-programming] login ke banyak mesin linux >>>>> Kepada: linux-programming@linux.or.id >>>>> Tanggal: Kamis, 26 Februari, 2009, 11:05 PM >>>>> yeah about the security note its alright because it's >>>>> just an experiment.. >>>>> >>>>> but still its possible right ?? >>>>> >>>>> oh iya kayanya bisa tuh pake expect... ada yang pernah >>>>> nyoba gak ?? >>>>> >>>>> thanks >>>>> >>>>> On 2/26/09, Yohanes Nugroho <yoha...@gmail.com> >>>>> wrote: >>>>>> 2009/2/25 net <netzerosp...@gmail.com>: >>>>>>> mau login ke banyak mesin linux dengan menggunakan >>>>> ssh >>>>>>> tapi ga pake private public key >>>>>> coba pake program sshpass (di debian ada packagenya, >>>>> mestinya untuk >>>>>> linux lain juga ada). >>>>>> >>>>>> Tapi renungkan dulu ini: >>>>>> >>>>>> SECURITY NOTE: There is a reason openssh insists that >>>>> passwords be typed >>>>>> interactively. Passwords are harder to store securely >>>>> and to pass around >>>>>> securely between programs. If you have not looked into >>>>> solving your needs >>>>>> using SSH's "public key authentication", >>>>> perhaps in conjunction with the ssh >>>>>> agent (RTFM ssh-add), please do so before being >>>>> tempted into using this >>>>>> package. >>>>>> >>>>>> -- >>>>>> Regards >>>>>> Yohanes >>>>>> http://tinyhack.com/freewarelist/s603rd/ -- Donny Kurnia http://hantulab.blogspot.com http://www.plurk.com/user/donnykurnia -- Berhenti langganan: linux-programming-unsubscr...@linux.or.id Arsip dan info: http://linux.or.id/milis