There are two big things that matter for programmers: knowing what needs to be done, and doing it. So when a server that you SSH into tells you that it wants to be restarted, it’s nice to just do that quick SSH reboot. So long as you trust that nothing will break (a small but import thing) the process of power cycling a server you only have access to over SSH isn’t too many steps.
If you like, here’s a video explaining how you power cycle a remote server that you’ve connected to via SSH:
Step by Step Guide to Restarting a Remote Server using SSH Reboot
And here’s the written form:
- Log in to the server via SSH. You should be able to do this if you’re authorized to change the machine ;p
- Type
sudo reboot
. This will kick you out of the machine, because it’ll be powering down. You’ll need to wait for the power-cycle, then you’ll be able to reconnect. - That’s basically it.
The video says a bit more. The big thing to know if that if you’re logged in as the “root” — most powerful — user on the system, the sudo
is unnecessary. But if you’re instead just a normal user — which is generally recommended as a general security measure — you’ll need it. sudo
is a simple command that basically means “for the stuff I type after this, use an elevate permissions level.” Or, in other words “as a ‘super-user'”.
Because non-root users don’t typically have the ability to reboot
over SSH, you’ll need that to do so. But otherwise that’s all you need.
Another thing to note is that you’ll be disconnected if the command executes successfully. This makes sense. A system that’s powering off to then come back up will inherently drop all of it’s external connection, including the one to you via SSH.
For more advice about using the Unix command line and more, check out this recent article.
This is self evident.
How about an article on setting up dedicated users that reboot and shutdown respectively upon login?
That is what most people mean when they speak of an SSH shutdown, and by an rc file on the machine, nothing plinky nor scripty on the client side.
Doing it by hand is messy, and it will be only a matter of time before before you bring down the wrong machine.
Only two words in the command and you spent 1:37 to get one of them wrong.
Okay then YOU do a good one then
Thank you for all the great Unix command line articles!