I am trying to send file to SFTP through shell script, But receiving the below error
Bad protocol 2 host key algorithms '+ssh-dss'
But if run the SFTP command manually, i am able to transfer the file.
Please suggest.
I recently ran into this error too. It happened in my case because I had modified my SSH config file for a version 7.0 client. Then I tried to use the same config with another machine using SSH 6.6. Steps:
ssh -V. If it's OpenSSH_6.6... you're probably in the same boat as I was.~/.ssh/config, where ~ represents your home directory. If you don't find one, look for one at /etc/ssh/ssh_config.HostKeyAlgorithms +ssh-dss.# to the start.After re-reading the original post, it looks like the problem may just be running two different versions of SSH, perhaps 7.0 in the shell and 6.6 in the script. This may be a better solution in that case:
type -a sftp. The top result is the sftp your shell is using. E.g. /usr/local/bin/sftp. If there are more results, your script is likely running one of those because it has a different PATH definition.sftp call in your script to the full path of the sftp binary you found in step 1.echo $PATH in your shell. Copy the output and add a line near the top of your script: export PATH='<path you copied>'If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With