SFTP dual authentication with batchfile
1
vote
1
answer
536
views
I'm trying to connect to a server where dual authentication
(publickey,password)
is enabled. I'm using sshpass
to provide password to automate the script, but when I have batchfile with SFTP, connection fails without batchfile connection succeeds
> export SSHPASS=helloworld
>
> (sshpass -e sftp -b batfile.txt -o 'PasswordAuthentication=yes' \
> -o 'PreferredAuthentications=publickey,password' -o 'StrictHostKeyChecking=no' user@hostname)
Error:
> Permission denied (password).
> Couldn't read packet: Connection reset by peer
Connection is successful without batchfile
> (sshpass -e sftp -o 'PasswordAuthentication=yes' \
> -o 'PreferredAuthentications=publickey,password' -o 'StrictHostKeyChecking=no' user@hostname)
I've tried providing password inside a batchfile but no luck.
Is it possible what I'm trying to achieve sshpass
along with batchfile
, if so, can someone please help me on this
Batchfile:
echo "Hey, I'm from Inside"
!echo "Hey, I'm from Outside"
Asked by Aravind
(1679 rep)
Nov 3, 2021, 05:43 AM
Last activity: Oct 27, 2022, 11:25 AM
Last activity: Oct 27, 2022, 11:25 AM