Skip to main content

How to Reboot a Linux Server via SSH?

Rebooting a Linux server via SSH is a common administrative task required when applying configuration changes, installing updates, or troubleshooting system issues. This guide shows you how to safely restart your server using a simple SSH command. Note that rebooting will cause temporary service interruption, so schedule the reboot during a maintenance window when possible.

How to Do It

  1. Step 1: Connect to Your Server via SSH

    Open your terminal or SSH client and connect to your Linux server using your credentials. Ensure you have administrator (sudo) privileges. The basic command for connecting is:

    ssh username@your_server_ip_address

    Replace username with your actual user account on the server and your_server_ip_address with the IP address of your server. If you have configured SSH keys for authentication, this will allow you to connect without entering a password.

  2. Step 2: Execute the Reboot Command

    Type the following command to initiate the server reboot:

    sudo reboot

    You may be prompted to enter your password to confirm the sudo action. This is a security measure to ensure that only authorized users can perform system restarts.

    To avoid being prompted for a password every time you use sudo, you can configure your user account in the sudoers file, but this should be done with caution and by someone familiar with Linux permissions.

  3. Step 3: Wait for the Reboot to Complete

    Your SSH session will automatically terminate as the server begins the reboot process. The server will typically be back online within 1-3 minutes, depending on your system configuration and startup services.

    To check if your server is back online after a reboot, you can use the ping command from another terminal:

    ping your_server_ip_address

    Once you receive responses, it indicates that your server has restarted and is reachable. You can then reconnect via SSH to verify all services are running as expected.

Tips:

  • Always ensure you have a backup of important data before performing system reboots or updates.
  • Consider using the shutdown -r now command as an alternative to reboot. It performs the same action and can be useful if you need to specify additional options, such as scheduling a delayed restart.
  • If your server is part of a cluster or managed service, check with your provider for any specific instructions related to reboots.

Help Center

Most Popular Articles

Loading...

Latest Articles

Loading...

Categories

Loading...