nohurt
asked on
sftp client authentication methods
I'm trying to connect to an sftp server, but am unable to do so through a bash script. the server is expecting ssh key authentication by default and i'd like to do UserName/Password auth. Is there a way i can specify the type of auth i want to use and if so what are some examples? Such as:
sftp -oAuthenticationMethod=Pas sword MyName@ftp.ExampleServer.com
or
sftp -oAuthenticationMethod=SSH _KEY MyName@ftp.ExampleServer.com
I've tried using the -o options, but am not sure i got the syntax right.
also, i interactivly try and connect to the sftp server it will prompt me for a password and when i enter it, it's just fine.
i'm running the bash script on Linux machine which is trying to connect to a sftp server running on windows machine.
sftp -oAuthenticationMethod=Pas
or
sftp -oAuthenticationMethod=SSH
I've tried using the -o options, but am not sure i got the syntax right.
also, i interactivly try and connect to the sftp server it will prompt me for a password and when i enter it, it's just fine.
i'm running the bash script on Linux machine which is trying to connect to a sftp server running on windows machine.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
my authorized_key is in the file. If i "sftp username@server.com" i get in just fine and am at the sftp> prompt. But if i try and ssh or scp a file, it just hangs. i'm not sure what's going on.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
it turns out that the ftp server i connect to has to accept my ssh key on their side manally in the sftp server. i am not allowed to put a public ssh key on their server.
ASKER
expect << 'END' 2>&1 | tee -a $LogFile
set timeout 5
spawn sftp $env(UserID)@$env(HostToCo
expect "UserName@ftp.PartnerName.com's password: "
send -- "$env(Password) \r"
expect "sftp> "
send -- "cd $env(OutPutDir) \r"
expect "sftp> "
send -- "ls -l ../ \r"
expect "sftp> "
send "bye \r"
END
The partner has not "White listed" my ssh key on their server, so it doesn't work. I would like to know if there is an option for sftp so that i can be very specific on sftp command line the use of authentication (password or ssh key).