Hello everybody :),
I want to connect via ssh to the fortigate and make a reboot. code: sshpass -p 'password' ssh admin@192.168.209.155 exec reboot The fortigate expects y or n, how do I get the fortigate said y or n?
Solved! Go to Solution.
hiermit läuft es:
set host 192.168.209.155 set user admin set passw password # # spawn ssh -p 22 -o ConnectionAttempts=3 -o ConnectTimeout=60 -o StrictHostKeyChecking=no $user\@$host # # expect "assword:" send "$passw\n" expect "SOC" # #send " config global\n" #expect "(global)" # send "execute reboot\n" expect "(y/n)" # send "y\n"
maybe like so?
echo y | sshpass -p 'password' ssh admin@192.168.209.155 exec reboot
That depends on how sshpass treats stdin. I would give it a try.
Hi Ede,
looks not good.
the 'y' is not sending to the Fortinet.
At the moment I try it now with the expect command.
code:
spawn sshpass -p "password" ssh admin@192.168.209.155 exec reboot expect "Do you want to continue? (y/n)" {send_user "y\r"} expect eof ----------------------
but this are also not working.
hiermit läuft es:
set host 192.168.209.155 set user admin set passw password # # spawn ssh -p 22 -o ConnectionAttempts=3 -o ConnectTimeout=60 -o StrictHostKeyChecking=no $user\@$host # # expect "assword:" send "$passw\n" expect "SOC" # #send " config global\n" #expect "(global)" # send "execute reboot\n" expect "(y/n)" # send "y\n"
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2024 Fortinet, Inc. All Rights Reserved.