I am attempting to make a script to log into a server via ssh I can not use keys in this project. So i am trying to pass a hashed password but I am not having any luck .. here is what I have. Any help would be great.
!/usr/bin/expect -f
spawn ssh nix@server
expect "password:"
send "echo "6YepVNFkMm1YO/WwA+mZEYZrhfVStH4+01fHTCf/La0=" | \
openssl enc -base64 -d -aes-256-cbc -nosalt -pass env:passwd"
interact
Here is the return I get:
nix's password: extra characters after close-quote
while executing
"send "echo "6YepVNFkMm1YO/WwA+mZEYZrhfVStH4+01fHTCf/La0=" | \
openssl enc -base64 -d -aes-256-cbc -nosalt -pass env:passwd"
interact
"
Try this solution :
!/usr/bin/expect -f
spawn ssh nix@localhost
expect "password:"
send "echo '6YepVNFkMm1YO/WwA+mZEYZrhfVStH4+01fHTCf/La0=' | \
openssl enc -base64 -d -aes-256-cbc -nosalt -pass env:passwd"
interact
I replaced those double quotes with single quotes ie "send "echo "6YepVNFkMm1YO/WwA+mZEYZrhfVStH4+01fHTCf/La0="
to "echo '6YepVNFkMm1YO/WwA+mZEYZrhfVStH4+01fHTCf/La0='
Hope it helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.