linux - restart sshd service
巴扎黑
巴扎黑 2017-05-16 13:18:21
0
3
2005

Please enter the codeAlibaba 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.

Please tell me how to restart the sshd service conveniently. Please don't talk about restarting ssh. I am talking about the process of sshd and ssh-server.

巴扎黑
巴扎黑

reply all (3)
滿天的星座

If you have already installedopenssh-server的话(没有的话,要安装),因为Ubuntu已经使用Upstart来进行管理/etc/init.d里面的任务.所以/etc/init.d/sshd start已经无效了.注意: 应该用sudo service ssh start(注意: 是ssh,不是sshd)启动sshd服务,之后可以通过进程查看sshdThe process is already running.

    黄舟

    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

      为情所困

      Directly killall/kill the process before starting

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!