Avatar of Dan Packer
Dan Packer

asked on 

Trying to troubleshoot an SFTP script that uses Expect

I'm having trouble with an Expect script on Red Hat Enterprise Server 6.10.  I would think that the script below would spawn SFTP, then send the password.  I'm getting a Password error, which I am guessing is due to lots of escapable characters.

The script below gets me a "permission denied" error.  My password ( I changed some characters) is something like  r10@4g@$^#a&r*a^^$%  .  I have tried escaping the 'special' characters with \ and also tried escaping every character (so it looks like \r\1\0\@\4\g\@\$\^\#\a\&\r\*\a\^\^\$\%).  When I manually connect to the site and manually enter a password it works fine.

Can someone tell me what I might be missing?

Thanks for any advice you can provide,

-Dan

#!/usr/bin/expect
spawn sftp username@ftpprd.host.com
expect "username\@ftpprd.host.com\'s password: "
send "r10@4g@$^#a&r*a^^$%\n"


T
LinuxFTPShell Scripting* expect

Avatar of undefined
Last Comment
Dan Packer

8/22/2022 - Mon