Wednesday, July 27, 2016

How to shutdown linux machine on network



To shutdown the local machine immediately, we can execute this command as root or under sudo:

$ shutdown -h now
 
If it is a remote server that we want to shutdown, it could be slightly more involved.
  we need to have root privileges to shutdown a machine. However, many systems are configured to block root from logging in remotely using ssh. So, we need to ssh in as a regular, non-root user, and pass the sudo command to shutdown host.

$ ssh -t 192.168.1.112 'sudo shutdown -h now'
peter@192.168.1.112's password: 
[sudo] password for peter:


EmoticonEmoticon