- Ubuntu Linux: Start, Stop, Restart, Reload OpenSSH Server
- Start / Stop / Restart / Reload OpenSSH Server on Ubuntu
- Ubuntu Linux: Start OpenSSH Server
- Ubuntu Linux: Stop OpenSSH server
- Ubuntu Linux: Restart OpenSSH server
- How do I restart sshd daemon on Linux or Unix?
- Procedure to restart sshd daemon
- How to restart the SSHD daemon in Debian / Ubuntu Linux
- CentOS / RHEL / Fedora / Redhat Linux Restart SSHD server
- Restating the SSHD daemon on FreeBSD Unix
- OpenBSD Unix restart the SSHD service
- Solaris 10 command
- AIX Unix command
- HP-UX Unix command
- Command line SSHD restart for Apple macOS based laptop or desttop
- Restarting or reloading OpenSSH SSHD server on Alpine Linux
- Conclusion
- Как перезагрузить сервер Linux?
- Когда требуется перезагрузка?
- Как перезагрузить сервер через консоль?
- Как перезагрузить сервер по SSH?
- 1. Команда shutdown -r
- 2. Команда reboot
- 3. Команда init 6
- Что делать, если сервер не работает после перезагрузки
- SSH restart Linux system using reboot command
- How to login using ssh
- SSH restart Linux system
- SSH reboot command example
- sudo: no tty present and no askpass program specified
- A note about rebooting a large number of Linux servers
- Conclusion
- How to Restart Linux server using putty ssh client on Windows
- Step 1. Download putty
- Step 2. Install putty
- Step 3. Connect to the remote Linux server using putty
- Step 4. Restart Linux server using putty ssh client
- A note about su command
- Conclusion
Ubuntu Linux: Start, Stop, Restart, Reload OpenSSH Server
I need to provide a remote access to my Ubuntu Linux based server. How do I start / stop, OR restart the ssh server under Ubuntu Linux operating system using command line options?
You need to run a script called /etc/init.d/ssh to stop, start, and restart the OpenSSH server. You can also use the service command to control a System V init script. If you are using the latest version of Ubuntu such as 12.04 LTS or 13.04+, you need to use upstart job based commands as listed below.
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | Yes |
Requirements | Ubuntu Linux with sudo command |
Est. reading time | 3 mintues |
Start / Stop / Restart / Reload OpenSSH Server on Ubuntu
Latest version of Ubuntu such as Ubuntu Linux 16.04 LTS or 18.04 LTS and others use the systemctl command to control ssh server on Ubuntu. Older version use the service command. To find out your Ubuntu Linux version, type:
lsb_release -a
cat /etc/*release*
Sample outputs:
Ubuntu Linux: Start OpenSSH Server
Type the following command:
$ sudo /etc/init.d/ssh start
OR
$ sudo service ssh start
For systemd based Ubuntu Linux 16.04/18.04/20.04 LTS or above servers, run:
$ sudo systemctl start ssh
Ubuntu Linux: Stop OpenSSH server
Type the following command:
$ sudo /etc/init.d/ssh stop
OR
$ sudo service ssh stop
Again for systemd based Ubuntu Linux 16.04/18.04/20.04 LTS or above server, enter:
$ sudo systemctl stop ssh
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
Ubuntu Linux: Restart OpenSSH server
Type the following command:
$ sudo /etc/init.d/ssh restart
OR
$ sudo service ssh restart
For systemd based Ubuntu Linux 16.04/18.04/20.04 LTS or above server, execute:
$ sudo systemctl restart ssh
systemctl command in action on Ubuntu Linux desktop
Источник
How do I restart sshd daemon on Linux or Unix?
I made changed to my /etc/ssh/sshd_config file. How do I restart sshd daemon on Linux or Unix systems?
SSH is an acronym for Secure Shell. It is an Internet communication protocol that allows log into Linux or Unix bases systems and runs commands. One can exchange files using a secure channel over an insecure network such as the Internet. OpenSSH is developed as part of the OpenBSD project and by default installed on modern Linux and *BSD family of operating systems including macOS. This page shows how to restart sshd daemon using the command line option.
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | Yes |
Requirements | Linux or Unix-like OS with OpenSSH |
Est. reading time | 2 minutes |
Procedure to restart sshd daemon
- Open the terminal application
- Edit the file /etc/ssh/sshd_config using a text editor such as vi or nano.
- Restart sshd service on an Ubuntu or Debian Linux using the following command:
sudo systemctl restart ssh.service - RHEL/CentOS Linux user run:
sudo systemctl restart sshd.service
The command to restart sshd varies from one variant of Linux or Unix distro to another. Hence, we will see all other commands below. Please note that you must login as root user to restart services. Either use the su command or sudo command.
How to restart the SSHD daemon in Debian / Ubuntu Linux
Type the systemctl command:
$ sudo systemctl restart ssh
CentOS / RHEL / Fedora / Redhat Linux Restart SSHD server
$ sudo systemctl restart sshd
Restating the SSHD daemon on FreeBSD Unix
# /etc/rc.d/sshd restart
OR
# service sshd restart
OpenBSD Unix restart the SSHD service
# /etc/rc.d/sshd restart
OR
# /etc/rc.d/sshd restart
Solaris 10 command
# svcadm disable ssh
# svcadm enable ssh
Solaris version 9 and older users, try:
# /etc/init.d/sshd stop
# /etc/init.d/sshd start
AIX Unix command
# stopsrc -s sshd
# startsrc -s sshd
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
HP-UX Unix command
To restart sshd daemon on HP-UX, first stop it and again start it as follows:
# /sbin/init.d/secsh stop
# /sbin/init.d/secsh start
Command line SSHD restart for Apple macOS based laptop or desttop
Open the terminal application and type the following two commands
$ sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
$ sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
Restarting or reloading OpenSSH SSHD server on Alpine Linux
Use the service command:
# service sshd restart
# service sshd reload
Conclusion
This page explained how to restart sshd daemon on Linux or Unix-like operating systems using various command-line options. For more information, see the official OpenSSH documents here. Another option is to read more about ssh client and sshd server by typing the following man command:
man ssh
man sshd
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник
Как перезагрузить сервер Linux?
В статье рассмотрим, как перезагрузить (перезапустить) по SSH сервер Linux. Например, перезагрузить сервер Ubuntu, CentOS Debian и основанные на них дистрибутивы можно удаленно по SSH или подключившись к командной строке другим способом.
Прежде чем перейти к боевым действиям, убедитесь, что сервер Линукс действительно нуждается в перезагрузке.
Когда требуется перезагрузка?
Как бы это странно ни звучало: перед тем как перезагрузить сервер сайта, стоит убедиться что оно ему действительно надо. Перезагрузка сервера без веских на то причин может привести к сбоям в работе серверного оборудования.
Так когда перезагружаем?
- Сервер завис или тормозит;
- Некорректно работают установленные программы;
- При смене операционной системы;
- При работе с BIOS (если есть физический доступ или его эмуляция);
- При использовании программ низкоуровневого копирования и восстановления данных (например, Acronis Backup).
На всякий пожарный: не перезагружайте сервер во время установки/удаления программ.
Как перезагрузить сервер через консоль?
Linux-серверы можно перезагрузить в консоли 3 простыми способами (команды shutdown, reboot и init).
Вы можете использовать любое решение для удаленного подключения к серверу. Мы остановимся на SSH.
Как перезагрузить сервер по SSH?
Все действия должны выполняться из-под пользователя root.
Подключитесь к вашему серверу под root-пользователем. Пароль суперпользователя указан в личном кабинете и письме, отправленном после активации сервера:
После ввода команды соединение с сервером будет прервано. Перезагрузка займет до 15 минут.
1. Команда shutdown -r
Это базовая команда, которая используется для перезагрузки Linux-сервера с Ubuntu.
Введите команду, и сервер будет перезагружен сразу:
Еще можно запланировать перезагрузку, введя вместо now конкретное время. Например, назначим перезагрузку сервера на 11 утра:
shutdown -r 11:00
Также можно перезагрузить сервер через небольшой промежуток времени. Например, через 5 минут:
2. Команда reboot
Также можно перезагрузить Linux-серверы с Ubuntu, Debian, CentOS или другим дистрибутивом с помощью универсальной команды reboot.
Сначала она запишет в логи время остановки системы, уничтожит незавершенные процессы, вызовет опцию sync и дождется завершения записи на диск. И только после этих предварительных действий прекратит работу ядра и инициирует перезагрузку.
Введите команду, и сервер будет перезагружен сразу:
После ввода команды соединение с сервером будет прервано. Консоль оповестит: The system is going down for reboot NOW!
3. Команда init 6
Также для перезагрузки можно использовать уровни системы инициализации Init Scripts. Всего в этой системе 6 уровней: где 0 — выключение, а 6 — перезагрузка. Чтобы перейти к этому уровню, используйте команду:
Что делать, если сервер не работает после перезагрузки
Если в ходе перезагрузки что-то пошло не так, можно узнать о состоянии сервера, подключившись через IP-KVM.
Если решить проблему самостоятельно не получится, обратитесь в техническую поддержку. Специалисты перезагрузят сервер вручную и заменят неисправные комплектующие , если это потребуется.
Нужен надежный и недорогой выделенный сервер?
Выделенные серверы по низким ценам! Переходи и выбирай свой!
Источник
SSH restart Linux system using reboot command
How to login using ssh
The syntax is:
ssh user@server
ssh user@server-ip-address
ssh root@server1.cyberciti.biz
For security reasons root login is always disabled on Linux servers. In that case login as normal user and use the su command or sudo command to gain root shell:
ssh vivek@server1.cyberciti.biz
sudo -i
Verify with id command:
id
SSH restart Linux system
Now, you know how to log in as root user using ssh command:
ssh user@linux-box
We will now reboot the Linux server using ssh. The syntax is as follows (use any one of the following command):
# reboot
# shutdown -r now
# shutdown -r 0
One can use the sudo command as follows:
$ sudo shutdown -r now
All of the above commands would reboot the machine. See “SSH Public Key Based Authentication on a Linux/Unix server” for more information.
SSH reboot command example
There is a shortcut too. You can use ssh to log in and run commands. The syntax is as follows when you log in as non-root user:
ssh -t vivek@server1.cyberciti.biz «sudo reboot»
ssh -t vivek@server1.cyberciti.biz «sudo shutdown -r now»
Of course, if you log in to Linux server as root user, avoid typing sudo:
ssh -t root@server1.cyberciti.biz «reboot»
ssh -t root@server1.cyberciti.biz «shutdown -r now»
Restarting Linux computer using ssh command line option
sudo: no tty present and no askpass program specified
If you skip the -t option to the ssh command, you will see an error that read as follows on screen:
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
sudo: no tty present and no askpass program specified
A note about rebooting a large number of Linux servers
You can use bash for loop as follows to reboot 5 servers named www1, www2, db1, db2, and cache1:
And, there is an Ansible tool to reboot Linux machine or server with playbooks too. Say you want to reboot 100 AWS vms or servers. A bash for loop is slow and not very useful. Hence, you use an IT automation tool such as Ansible.
Conclusion
In this tutorial, you learned how to reboot the Linux machine using ssh. See shutdown(8) man page here for more info.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник
How to Restart Linux server using putty ssh client on Windows
Step 1. Download putty
Visit this url and grab the putty package.
Step 2. Install putty
Just double click on the downloaded file “putty-64bit-0.70-installer.msi” and install on your system.
Step 3. Connect to the remote Linux server using putty
Open the putty application from Start menu or desktop shortcut and you will see an window as follows:
Step 4. Restart Linux server using putty ssh client
You must have the following information in order to reboot the Linux box:
- Linux server IP address or FQDN: For example, 192.168.2.18 or 202.54.1.1 or server1.cyberciti.biz
- Linux server username: For example: vivek
- sudo command privileges or root account password that can be used with the su command
You need to type your server IP address, port and select ssh as connection method as follows:
If you are connecting first time, you should see an alert window as follows:
Just click the “Yes” button and you will get server login session as follows:
The sudo command means “superuser do.” It prompts you for your password and confirms your request to execute a command. You must enter your username and password. Once logged in type any one of the following command to reboot the Linux server:
sudo reboot
OR
sudo shutdown -r 0
When prompted you must type your password, and the Linux server will reboot. It will take 2-5 minutes for the server to come back online. You can verify that with the ping command to log in using putty again:
ping 192.168.2.18
A note about su command
The su command stands for “switch user”, and allows you to become root user. If sudo command is not available or installed or enabled on your Linux server. Use the su command as follows to become the root user (first, log in using putty and then type):
su —
When prompted for a password, you must type root user password. Once you become a root, type the following command to reboot the Linux server:
reboot
I restart Linux server using putty ssh client. It will take some time to boot the server again. So have some patience.
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
Conclusion
And there you have it, and you just rebooted the Linux server using putty client for Windows family of operating systems.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник