Q.) How to shut down / restart a remote linux server from ssh ?
A.) ssh -t user@hostname 'sudo shutdown -P now'
In the above example
-t : forces the allocation of a tty for the command.
-P : stands for power off.
-r : to reboot.
-h : to halt.
Also all the shutdown arguments can be passed along. To know more about shutdown options run command.
shutdown --help
A.) ssh -t user@hostname 'sudo shutdown -P now'
In the above example
-t : forces the allocation of a tty for the command.
-P : stands for power off.
-r : to reboot.
-h : to halt.
Also all the shutdown arguments can be passed along. To know more about shutdown options run command.
shutdown --help
Remote shutdown one line ssh command
4/
5
Oleh
Admin