|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I have been struggling with a project that requires me to use sftp.
After working through all the issues getting sftp working on AIX 5.3, I now need to automate the sftp process. This appears harder than it should be. It appears that getting past the password prompt is a frustration everyone runs up against. After much reading, I thought Expect was the key and I installed it. Unfortunately, it does not seem to be working. Here is what I am trying: # /usr/bin/expect << EOF > spawn sftp username@sftp.site.com > expect "password:" > send "my_password" > expect "sftp>" > send "ls" > expect "sftp>" > send "quit" > EOF And here is what I am getting: spawn sftp username@sftp.site.com Connecting to sftp.site.com... username@sftp.site.com's password: # As you can see, I am still being prompted for the password. What am I doing incorrectly? -Thanks |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
In comp.unix.shell rsine <rsine@stationeryhouse.com>:
> I have been struggling with a project that requires me to use sftp. [..] > As you can see, I am still being prompted for the password. What am I > doing incorrectly? Simply setup ssh keylogin and you do not need a password at all: $ sftp localhost Connecting to localhost... sftp> It is explained in the ssh man page: man ssh /authorized_keys And there are probably hundreds of guides online accessible through a web search how to set this up. Extra points for running ssh-agent, though you should do better even with an empty pass phrase then putting the password in a file. Good luck -- Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94) mail: echo zvpunry@urvzvat.qr | perl -pe 'y/a-z/n-za-m/' #bofh excuse 13: we're waiting for [the phone company] to fix that line |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Fri, 13 Jul 2007 08:03:19 -0700, rsine
<rsine@stationeryhouse.com> wrote: > > > I have been struggling with a project that requires me to use sftp. > After working through all the issues getting sftp working on AIX 5.3, > I now need to automate the sftp process. This appears harder than it > should be. It appears that getting past the password prompt is a > frustration everyone runs up against. After much reading, I thought > Expect was the key and I installed it. Unfortunately, it does not > seem to be working. Here is what I am trying: > > # /usr/bin/expect << EOF >> spawn sftp username@sftp.site.com >> expect "password:" >> send "my_password" send "my_password\r" -- Police are unsure if the same wookie is involved in Sunday's assault. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Jul 13, 1:04 pm, Bill Marcum <marcumb...@bellsouth.net> wrote:
> On Fri, 13 Jul 2007 08:03:19 -0700, rsine <rs...@stationeryhouse.com> wrote: > > > I have been struggling with a project that requires me to use sftp. > > After working through all the issues getting sftp working on AIX 5.3, > > I now need to automate the sftp process. This appears harder than it > > should be. It appears that getting past the password prompt is a > > frustration everyone runs up against. After much reading, I thought > > Expect was the key and I installed it. Unfortunately, it does not > > seem to be working. Here is what I am trying: > > > # /usr/bin/expect << EOF > >> spawn sftp usern...@sftp.site.com > >> expect "password:" > >> send "my_password" > > send "my_password\r" > > -- > Police are unsure if the same wookie is involved in Sunday's assault. Bill, I think my issue is with the password. The vendor created one with "$ $" in it ala AbCDE$$123. I know the "$" symbol has a special meaning for Unix. How can I pass the "$$" in a password? Enclosing the password in quotes did not . |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Jul 13, 1:17 pm, rsine <rs...@stationeryhouse.com> wrote:
> On Jul 13, 1:04 pm, Bill Marcum <marcumb...@bellsouth.net> wrote: > > > > > > > On Fri, 13 Jul 2007 08:03:19 -0700, rsine <rs...@stationeryhouse.com> wrote: > > > > I have been struggling with a project that requires me to use sftp. > > > After working through all the issues getting sftp working on AIX 5.3, > > > I now need to automate the sftp process. This appears harder than it > > > should be. It appears that getting past the password prompt is a > > > frustration everyone runs up against. After much reading, I thought > > > Expect was the key and I installed it. Unfortunately, it does not > > > seem to be working. Here is what I am trying: > > > > # /usr/bin/expect << EOF > > >> spawn sftp usern...@sftp.site.com > > >> expect "password:" > > >> send "my_password" > > > send "my_password\r" > > > -- > > Police are unsure if the same wookie is involved in Sunday's assault. > > Bill, > > I think my issue is with the password. The vendor created one with "$ > $" in it ala AbCDE$$123. I know the "$" symbol has a special meaning > for Unix. How can I pass the "$$" in a password? Enclosing the > password in quotes did not .- Hide quoted text - > > - Show quoted text - Thanks for all the . After more research, I discovered autoexpect. Using this tool, I was able to capture all that I was executing. Looking at the autoexpect file, I found the password needed the dollar signs entered as "\$\$" and the "\r" needed to be concatenated to the data (I was leaving a space between). For all those novices like me, here is what I found to work: expect << EOF spawn sftp username@sftp.site.com expect "password:" send -- "my_pa\$\$word\r" expect "sftp> " send -- "ls\r" expect "sftp> " send -- "exit\r" EOF |
|
![]() |
| Outils de la discussion | |
|
|