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.
Nominating a forum post submits a request to create a new Knowledge Article based on the forum post topic. Please ensure your nomination includes a solution within the reply.
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"
Select Forum Responses to become Knowledge Articles!
Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.
User | Count |
---|---|
1713 | |
1093 | |
752 | |
447 | |
231 |
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.