Skip to content

How to Reboot a Server Over SSH

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:

  1. Log in to the server via SSH. You should be able to do this if you’re authorized to change the machine ;p
  2. 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.
  3. 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.

Yay! 🎉 You made it to the end of the article!
David Hayes

4 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Matthew H. McKenzie
November 7, 2018 5:49 pm

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.

foo bar bar
January 26, 2018 10:33 am

Only two words in the command and you spent 1:37 to get one of them wrong.

Fred Meyer
January 26, 2018 11:54 am
Reply to  foo bar bar

Okay then YOU do a good one then

Tom Dana
February 3, 2017 8:59 am

Thank you for all the great Unix command line articles!

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!

4
0
Would love your thoughts, please comment.x

Most Searched Articles

Best JavaScript Libraries and Frameworks: Try These 14 in 2024

In this post, we look at the best JavaScript libraries and frameworks to try out this year. Why? Well, with JavaScript being available in every web browser, this makes it the most accessible programming language of ...

20 Best Free WordPress Themes for 2024 (Responsive, Mobile-Ready, Beautiful)

If you're looking for only the best free WordPress themes in the market for this year, then you're in the right place. We have more than enough such themes for you right ...

12 Best WordPress Hosting Providers of 2024 Compared and Tested

Looking for the best WordPress hosting that you can actually afford? We did the testing for you. Here are 10+ best hosts on the market ...

Handpicked Articles

How to Make a WordPress Website: Ultimate Guide for All Users – Beginners, Intermediate, Advanced

Many people wonder how to make a WordPress website. They’ve heard about WordPress, its incredible popularity, excellent features and designs, and now they want to join the pack and build a WordPress website of their own. So, where does one get ...

How to Start an Ecommerce Business: Ultimate Guide for 2024

Is this going to be the year you learn how to start an eCommerce business from scratch? You’re certainly in the right place! This guide will give you a roadmap to getting from 0 to a fully functional eCommerce business. ...