vim /usr/lib/systemd/system/sshd.service
[Unit]
Description=OpenSSH server daemon
Documentation=man:sshd(8) man:sshd_config(5)
After=network.target sshd-keygen.service
Wants=sshd-keygen.service [Service]
Type=notify
EnvironmentFile=/etc/sysconfig/sshd
ExecStart=/usr/sbin/sshd -d -D $OPTIONS // 添加-d
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=42s [Install]
WantedBy=multi-user.target

然后重启服务

systemctl daemon-reload
systemctl restart sshd

查看系统日志

 journalctl  -xe -u sshd  -f

在另开一个终端,使用ssh登录不同用户就会看到debug信息

-- Subject: Unit sshd.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit sshd.service has finished starting up.
--
-- The start-up result is done.
Jul 02 15:26:52 prophet268 sshd[27633]: debug1: private host key #1: ecdsa-sha2-nistp256 SHA256:cNmWmzJVrXuESZXn75p+5vaYwcRdTgn3A+EorcM+k2Y
Jul 02 15:26:52 prophet268 sshd[27633]: debug1: private host key #2: ssh-ed25519 SHA256:hH55TxiE+wxkXJGnbipDvFdyHZSAkV5XZxM22L3pIkc
Jul 02 15:26:52 prophet268 sshd[27633]: debug1: rexec_argv[0]='/usr/sbin/sshd'
Jul 02 15:26:52 prophet268 sshd[27633]: debug1: rexec_argv[1]='-d'
Jul 02 15:26:52 prophet268 sshd[27633]: debug1: rexec_argv[2]='-D'
Jul 02 15:26:52 prophet268 sshd[27633]: debug1: Set /proc/self/oom_score_adj from 0 to -1000
Jul 02 15:26:52 prophet268 sshd[27633]: debug1: Bind to port 22 on 0.0.0.0.
Jul 02 15:26:52 prophet268 sshd[27633]: Server listening on 0.0.0.0 port 22.
Jul 02 15:26:52 prophet268 sshd[27633]: debug1: Bind to port 22 on ::.
Jul 02 15:26:52 prophet268 sshd[27633]: Server listening on :: port 22. Jul 02 15:28:58 prophet268 sshd[27633]: debug1: Server will not fork when running in debugging mode.
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8
Jul 02 15:28:58 prophet268 sshd[27633]: rexec line 42: Deprecated option RSAAuthentication
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: sshd version OpenSSH_7.4, OpenSSL 1.0.2k-fips 26 Jan 2017
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: inetd sockets after dupping: 3, 3
Jul 02 15:28:58 prophet268 sshd[27633]: Connection from ::1 port 45036 on ::1 port 22
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: private host key #0: ssh-rsa SHA256:R8GeBmf5SzJ22r7wpGyUuXhYQnhxPyVNZHQShdjAldI
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: private host key #1: ecdsa-sha2-nistp256 SHA256:cNmWmzJVrXuESZXn75p+5vaYwcRdTgn3A+EorcM+k2Y
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: private host key #2: ssh-ed25519 SHA256:hH55TxiE+wxkXJGnbipDvFdyHZSAkV5XZxM22L3pIkc
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: Client protocol version 2.0; client software version OpenSSH_7.4
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: Local version string SSH-2.0-OpenSSH_7.4
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: Enabling compatibility mode for protocol 2.0
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: SELinux support enabled [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: permanently_set_uid: 74/74 [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: list_hostkey_types: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: SSH2_MSG_KEXINIT sent [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: SSH2_MSG_KEXINIT received [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: kex: algorithm: curve25519-sha256 [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: kex: host key algorithm: ecdsa-sha2-nistp256 [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: kex: curve25519-sha256 need=64 dh_need=64 [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: kex: curve25519-sha256 need=64 dh_need=64 [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: rekey after 134217728 blocks [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: SSH2_MSG_NEWKEYS sent [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: expecting SSH2_MSG_NEWKEYS [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: SSH2_MSG_NEWKEYS received [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: rekey after 134217728 blocks [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: KEX done [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: userauth-request for user root service ssh-connection method none [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: attempt 0 failures 0 [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: reprocess config line 42: Deprecated option RSAAuthentication
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: PAM: initializing for "root"
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: PAM: setting PAM_RHOST to "localhost"
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: PAM: setting PAM_TTY to "ssh"
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: userauth-request for user root service ssh-connection method publickey [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: attempt 1 failures 0 [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: userauth_pubkey: test whether pkalg/pkblob are acceptable for RSA SHA256:TstxdnvVdWV4TzqSNnhHDhTZWzNPoUeTn7DXHgbCVPQ [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: temporarily_use_uid: 0/0 (e=0/0)
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: trying public key file /root/.ssh/authorized_keys
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: fd 4 clearing O_NONBLOCK
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: restore_uid: 0/0
Jul 02 15:28:58 prophet268 sshd[27633]: Failed publickey for root from ::1 port 45036 ssh2: RSA SHA256:TstxdnvVdWV4TzqSNnhHDhTZWzNPoUeTn7DXHgbCVPQ
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: userauth-request for user root service ssh-connection method publickey [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: attempt 2 failures 1 [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: userauth_pubkey: test whether pkalg/pkblob are acceptable for DSA SHA256:K1gn5Xw0/Lodi/6sPHlmTsEFulyjSjjlhx4zii6NLiE [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: temporarily_use_uid: 0/0 (e=0/0)
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: trying public key file /root/.ssh/authorized_keys
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: fd 4 clearing O_NONBLOCK
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: restore_uid: 0/0
Jul 02 15:28:58 prophet268 sshd[27633]: Failed publickey for root from ::1 port 45036 ssh2: DSA SHA256:K1gn5Xw0/Lodi/6sPHlmTsEFulyjSjjlhx4zii6NLiE
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: userauth-request for user root service ssh-connection method publickey [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: attempt 3 failures 2 [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: userauth_pubkey: test whether pkalg/pkblob are acceptable for ECDSA SHA256:ITZJ9Rv6EGeKXqjlU1kYwlxshel9fcBb3WnESEmr6KI [preauth]
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: temporarily_use_uid: 0/0 (e=0/0)
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: trying public key file /root/.ssh/authorized_keys
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: fd 4 clearing O_NONBLOCK
Jul 02 15:28:58 prophet268 sshd[27633]: debug1: restore_uid: 0/0
Jul 02 15:28:58 prophet268 sshd[27633]: Failed publickey for root from ::1 port 45036 ssh2: ECDSA SHA256:ITZJ9Rv6EGeKXqjlU1kYwlxshel9fcBb3WnESEmr6KI
Jul 02 15:29:01 prophet268 sshd[27633]: debug1: userauth-request for user root service ssh-connection method password [preauth]
Jul 02 15:29:01 prophet268 sshd[27633]: debug1: attempt 4 failures 3 [preauth]
Jul 02 15:29:02 prophet268 sshd[27633]: debug1: PAM: password authentication accepted for root
Jul 02 15:29:02 prophet268 sshd[27633]: debug1: do_pam_account: called
Jul 02 15:29:02 prophet268 sshd[27633]: Accepted password for root from ::1 port 45036 ssh2
Jul 02 15:29:02 prophet268 sshd[27633]: debug1: monitor_child_preauth: root has been authenticated by privileged process
Jul 02 15:29:02 prophet268 sshd[27633]: debug1: monitor_read_log: child log fd closed
Jul 02 15:29:02 prophet268 sshd[27633]: debug1: temporarily_use_uid: 0/0 (e=0/0)
Jul 02 15:29:02 prophet268 sshd[27633]: debug1: ssh_gssapi_storecreds: Not a GSSAPI mechanism
Jul 02 15:29:02 prophet268 sshd[27633]: debug1: restore_uid: 0/0
Jul 02 15:29:02 prophet268 sshd[27633]: debug1: SELinux support enabled
Jul 02 15:29:02 prophet268 sshd[27633]: debug1: PAM: establishing credentials

debug 查询服务日志,用于定位服务在运行和启动过程中出现的问题的更多相关文章

  1. Windows平台下Oracle监听服务启动过程中日志输出

    Windows平台下Oracle监听服务启动过程中日志输出记录. 日志目录:D:\app\Administrator\diag\tnslsnr\WIN-RU03CB21QGA\listener\tra ...

  2. Windows平台下Oracle实例启动过程中日志输出

    Windows平台下Oracle实例启动过程中日志输出记录. 路径:D:\app\Administrator\diag\rdbms\orcl\orcl\trace\alert_orcl.log 输出内 ...

  3. springbank 开发日志 Spring启动过程中对自定义标签的处理

    这篇随笔的许多知识来源于:http://www.importnew.com/19391.html 之所以会去看这些东东,主要是希望能够模仿spring mvc的处理流程,做出一套合理的交易处理流程. ...

  4. 微服务日志监控与查询logstash + kafka + elasticsearch

    使用 logstash + kafka + elasticsearch 实现日志监控 https://blog.csdn.net/github_39939645/article/details/788 ...

  5. 【iOS】7.4 定位服务->2.1.3.3 定位 - 官方框架CoreLocation 功能3:区域监听

    本文并非最终版本,如果想要关注更新或更正的内容请关注文集,联系方式详见文末,如有疏忽和遗漏,欢迎指正. 本文相关目录: ================== 所属文集:[iOS]07 设备工具 === ...

  6. 【Android】第18章 位置服务和手机定位—本章示例主界面

    分类:C#.Android.VS2015: 创建日期:2016-03-04 一.简介 目前,基于位置的服务发展迅速,已涉及到商务.医疗.定位.追踪.敏感区域警告.工作和生活等各个方面.定位服务融合了G ...

  7. SpringCloud学习(3)——Eureka服务注册中心及服务发现

    Eureka概述: Eureka是Netflix的一个子模块, 也是核心模块之一.Eureka是一个基于REST的服务, 用于定位服务, 以实现云端中间层服务发现和故障转移.服务注册与发现对于微服务框 ...

  8. Linux服务管理(Ubuntu服务管理工具sysv-rc-conf)(转)

    Linux运行级别 Linux系统任何时候都运行在一个指定的运行级上,并且不同的运行级的程序和服务都不同,所要完成的工作和要达到的目的都不同,系统可以在这些运行级之间进行切换,以完成不同的工作. 运行 ...

  9. 微服务Consul系列之服务注册与服务发现

    在进行服务注册之前先确认集群是否建立,关于服务注册可以看上篇微服务Consul系列之集群搭建的介绍,两种注册方式:一种是注册HTTP API.另一种是通过配置文件定义,下面讲解的是基于后者配置文件定义 ...

随机推荐

  1. mysql 分组条件筛选

    mysql> select * from table1; +----------+------------+-----+---------------------+ | name_new | t ...

  2. Android中如何引入已经存在的标题栏

    在写程序中很多时候很多页面的标题布局大致都是一样的,这时候不需要挨着都写一遍,只需要写一个xml文件,在所需要的时候进行引用就可以了 只需要这一行代码: <include layout=&quo ...

  3. 更改matlab默认精度

    我使用的是R2018a 1.打开预设 2.命令行窗口 3.变量

  4. SQL优化-如何分析性能瓶颈

    MySQL优化一览图 笔者将优化分为了两大类:软优化和硬优化.软优化一般是操作数据库即可:而硬优化则是操作服务器硬件及参数设置. 1.软优化 1)查询语句优化 首先我们可以用EXPLAIN或DESCR ...

  5. linux升级openssl和php_openssl模块

    一.OpenSSL源码升级 2014年4月8日,XP宣布正式停止服务的日子,也是OpenSSL爆出大漏洞的日子. OpenSSL主要是负责在一些敏感的数据提交上面被广泛使用,不乏大家经常访问的一些网站 ...

  6. SQL中左连接on and条件和where条件执行先后顺序

    left join :左连接,返回左表中所有的记录以及右表中连接字段相等的记录. right join :右连接,返回右表中所有的记录以及左表中连接字段相等的记录. inner join: 内连接,又 ...

  7. RAID技术全解图解-RAID0、RAID1、RAID5、RAID100【转】

    图文并茂 RAID 技术全解 – RAID0.RAID1.RAID5.RAID100…… RAID 技术相信大家都有接触过,尤其是服务器运维人员,RAID 概念很多,有时候会概念混淆.这篇文章为网络转 ...

  8. [LeetCode] 40. Combination Sum II 组合之和 II

    Given a collection of candidate numbers (candidates) and a target number (target), find all unique c ...

  9. nvm安装、解决nvm command not found问题、卸载

    安装 nvm是node的包版本管理工具,github地址如下:nvm 安装命令 1 curl -o- https://raw.githubusercontent.com/creationix/nvm/ ...

  10. Jmeter3.1 使用及新增报告功能

    一.JMeter官网 下载地址http://jmeter.apache.org/download_jmeter.cgi Jmeter wikihttps://wiki.apache.org/jmete ...