remotely shutdown pc using ssh

Опубликовано: 21 Март 2026
на канале: Akash AOT
2,312
23

remotely shutdown pc using ssh #linux #terminal


login to root - in your pc [system]
ifconfig - to find out the ip
ssh root@[Target IP]
password [system or student]
sudo su
reboot
history -c



✅ All in one step ➡️ Aitomate the process


#!/bin/bash

Base IP address
base_ip="192.168.1."

Root password
password="system"

Loop through each host and send the reboot command
for i in $(seq 1 50); do
host="${base_ip}${i}"
echo "Rebooting $host..."

Use SSH to login and reboot the system
sshpass -p $password ssh -o StrictHostKeyChecking=no root@$host 'echo "system" | sudo -S reboot' &
done

wait
echo "All reboot commands sent."

✅ save the code
✅ sudo apt-get install sshpass
✅ chmod +x reboot_all.sh
✅ ./reboot_all.sh