Please enter the code
Alibaba Cloud's ubuntu server has an sshd daemon from the beginning and can be connected using putty
Modify the heartbeat packet time and modify /etc/ssh/sshd_config
When I wanted to restart the service, I found that there was no sshd under /etc/init.d
, and a search found that sshd existed under /usr/sbin
Unable to execute sshd restart, sshd start , sshd stop and other commands, it is prompted that there is no such command.
Unable to restart sshd service
Finally, by directly killing the sshd process, and then directly executing /usr/sbin/sshd
, you can start the sshd process again and load the modified configuration.
滿天的星座2017-05-16 13:20:21
If you have already installed openssh-server
的话(没有的话,要安装),因为Ubuntu已经使用Upstart
来进行管理/etc/init.d
里面的任务. 所以/etc/init.d/sshd start
已经无效了.注意: 应该用sudo service ssh start
(注意: 是ssh,不是sshd)启动sshd
服务,之后可以通过进程查看sshd
The process is already running.
黄舟2017-05-16 13:20:21
If you look at the /etc/init.d/ssh file, you will know that this file is the script to start, stop, and restart sshd, which is also called a service.
So you can start/stop/restart sshd via sudo /etc/init.d/ssh start/stop/restart or sudo service ssh start/stop/restart
case "" in
start)
check_for_upstart 1
check_privsep_dir
check_for_no_start
check_dev_null
log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd" || true
if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;
stop)
check_for_upstart 0
log_daemon_msg "Stopping OpenBSD Secure Shell server" "sshd" || true
if start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;
What is executed in this script is /usr/sbin/sshd