使用 xinetd 进行 ssh

使用 xinetd 进行 ssh

我想要配置 xinetd 以进行 ssh 连接(端口 55555)。

这是我的配置文件:

sshd 目录

service ssh
{
        disable = no
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/sbin/sshd
        server_args     = -i
        log_on_success += HOST PID
        log_on_failure += HOST USERID
        nice            = 10
}

然后我更改服务文件中的端口号:

vi /etc/services
    ssh  55555/tcp

最后,我停止 ssh 守护进程并重新启动 xinedt:

service sshd stop
service xinetd restart

我已将端口设置为 55555,并尝试使用 putty 登录。显示了“欢迎页面”,但输入密码时显示错误。

"Network error: Software caused connection abord" 

我检查了xinetd状态,没有pb。

在日志文件(/var/log/secure)中:

May 22 16:00:00 ttpp sshd[12734]: debug1: do_cleanup
May 22 16:00:00 ttpp sshd[12734]: debug1: PAM: cleanup
May 22 16:00:14 ttpp sshd[12761]: debug1: Bind to port 54321 on ::.
May 22 16:00:14 ttpp sshd[12761]: Server listening on :: port 54321.
May 22 16:00:14 ttpp sshd[12761]: debug1: Bind to port 54321 on 0.0.0.0.
May 22 16:00:14 ttpp sshd[12761]: error: Bind to port 54321 on 0.0.0.0 failed: Address already in use.
May 22 16:00:25 ttpp sshd[12763]: debug1: rexec start in 4 out 4 newsock 4 pipe 6 sock 7
May 22 16:00:25 ttpp sshd[12761]: debug1: Forked child 12763.
May 22 16:00:25 ttpp sshd[12763]: debug1: inetd sockets after dupping: 3, 3
May 22 16:00:25 ttpp sshd[12763]: Connection from ***.***.***.*** port 61943
May 22 16:00:25 ttpp sshd[12763]: debug1: Client protocol version 2.0; client software version PuTTY_Release_0.62
May 22 16:00:25 ttpp sshd[12763]: debug1: no match: PuTTY_Release_0.62
May 22 16:00:25 ttpp sshd[12763]: debug1: Enabling compatibility mode for protocol 2.0
May 22 16:00:25 ttpp sshd[12763]: debug1: Local version string SSH-2.0-OpenSSH_4.3
May 22 16:00:25 ttpp sshd[12764]: debug1: permanently_set_uid: 74/74
May 22 16:00:25 ttpp sshd[12764]: debug1: list_hostkey_types: ssh-rsa,ssh-dss
May 22 16:00:25 ttpp sshd[12764]: debug1: SSH2_MSG_KEXINIT sent
May 22 16:00:25 ttpp sshd[12764]: debug1: SSH2_MSG_KEXINIT received
May 22 16:00:25 ttpp sshd[12764]: debug1: kex: client->server aes256-ctr hmac-sha1 none
May 22 16:00:25 ttpp sshd[12764]: debug1: kex: server->client aes256-ctr hmac-sha1 none
May 22 16:00:25 ttpp sshd[12764]: debug1: SSH2_MSG_KEX_DH_GEX_REQUEST_OLD received
May 22 16:00:25 ttpp sshd[12764]: debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
May 22 16:00:25 ttpp sshd[12764]: debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
May 22 16:00:25 ttpp sshd[12764]: debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
May 22 16:00:25 ttpp sshd[12764]: debug1: SSH2_MSG_NEWKEYS sent
May 22 16:00:25 ttpp sshd[12764]: debug1: expecting SSH2_MSG_NEWKEYS
May 22 16:00:25 ttpp sshd[12764]: debug1: SSH2_MSG_NEWKEYS received
May 22 16:00:25 ttpp sshd[12764]: debug1: KEX done
May 22 16:00:26 ttpp sshd[12764]: debug1: userauth-request for user **** service ssh-connection method none
May 22 16:00:26 ttpp sshd[12764]: debug1: attempt 0 failures 0
May 22 16:00:26 ttpp sshd[12763]: debug1: PAM: initializing for "****"
May 22 16:00:26 ttpp sshd[12764]: debug1: userauth-request for user **** service ssh-connection method gssapi-with-mic
May 22 16:00:26 ttpp sshd[12764]: debug1: attempt 1 failures 1
May 22 16:00:26 ttpp sshd[12763]: debug1: PAM: setting PAM_RHOST to "p37200-ipbffx02marunouchi.tokyo.ocn.ne.jp"
May 22 16:00:26 ttpp sshd[12763]: debug1: PAM: setting PAM_TTY to "ssh"
May 22 16:00:26 ttpp sshd[12763]: debug1: An invalid name was supplied\nHostname cannot be canonicalized\n
May 22 16:00:30 ttpp sshd[12764]: debug1: userauth-request for user **** service ssh-connection method password
May 22 16:00:30 ttpp sshd[12764]: debug1: attempt 2 failures 2
May 22 16:00:30 ttpp sshd[12763]: debug1: PAM: password authentication accepted for ****
May 22 16:00:30 ttpp sshd[12763]: debug1: do_pam_account: called
May 22 16:00:30 ttpp sshd[12763]: Accepted password for **** from ***.***.***.*** port 61943 ssh2
May 22 16:00:30 ttpp sshd[12763]: debug1: monitor_child_preauth: **** has been authenticated by privileged process
May 22 16:00:30 ttpp sshd[12763]: debug1: temporarily_use_uid: 501/10 (e=0/0)
May 22 16:00:30 ttpp sshd[12763]: debug1: ssh_gssapi_storecreds: Not a GSSAPI mechanism
May 22 16:00:30 ttpp sshd[12763]: debug1: restore_uid: 0/0
May 22 16:00:30 ttpp sshd[12763]: debug1: PAM: establishing credentials
May 22 16:00:30 ttpp sshd[12763]: pam_unix(sshd:session): session opened for user **** by (uid=0)
May 22 16:00:30 ttpp sshd[12765]: debug1: PAM: reinitializing credentials
May 22 16:00:30 ttpp sshd[12765]: debug1: permanently_set_uid: 501/10
May 22 16:00:30 ttpp sshd[12765]: debug1: Entering interactive session for SSH2.
May 22 16:00:30 ttpp sshd[12765]: debug1: server_init_dispatch_20
May 22 16:00:30 ttpp sshd[12765]: debug1: server_input_channel_open: ctype session rchan 256 win 16384 max 16384
May 22 16:00:30 ttpp sshd[12765]: debug1: input_session_request
May 22 16:00:30 ttpp sshd[12765]: debug1: channel 0: new [server-session]
May 22 16:00:30 ttpp sshd[12765]: debug1: session_new: init
May 22 16:00:30 ttpp sshd[12765]: debug1: session_new: session 0
May 22 16:00:30 ttpp sshd[12765]: debug1: session_open: channel 0
May 22 16:00:30 ttpp sshd[12765]: debug1: session_open: session 0: link with channel 0
May 22 16:00:30 ttpp sshd[12765]: debug1: server_input_channel_open: confirm session
May 22 16:00:30 ttpp sshd[12765]: debug1: server_input_channel_req: channel 0 request pty-req reply 1
May 22 16:00:30 ttpp sshd[12765]: debug1: session_by_channel: session 0 channel 0
May 22 16:00:30 ttpp sshd[12765]: debug1: session_input_channel_req: session 0 req pty-req
May 22 16:00:30 ttpp sshd[12765]: debug1: Allocating pty.
May 22 16:00:30 ttpp sshd[12763]: debug1: session_new: init
May 22 16:00:30 ttpp sshd[12763]: debug1: session_new: session 0
May 22 16:00:30 ttpp sshd[12763]: debug1: user_context: user_u:system_r:unconfined_t old_tty_context: user_u:object_r:devpts_t
May 22 16:00:30 ttpp sshd[12765]: debug1: session_pty_req: session 0 alloc /dev/pts/4
May 22 16:00:30 ttpp sshd[12765]: debug1: server_input_channel_req: channel 0 request shell reply 1
May 22 16:00:30 ttpp sshd[12765]: debug1: session_by_channel: session 0 channel 0
May 22 16:00:30 ttpp sshd[12765]: debug1: session_input_channel_req: session 0 req shell
May 22 16:00:30 ttpp sshd[12766]: debug1: Setting controlling tty using TIOCSCTTY.
May 22 16:00:33 ttpp sshd[12765]: debug1: server_input_channel_req: channel 0 request window-change reply 0
May 22 16:00:33 ttpp sshd[12765]: debug1: session_by_channel: session 0 channel 0
May 22 16:00:33 ttpp sshd[12765]: debug1: session_input_channel_req: session 0 req window-change
May 22 17:21:31 ttpp sshd[12761]: debug1: Forked child 13170.
May 22 17:21:31 ttpp sshd[13170]: debug1: rexec start in 4 out 4 newsock 4 pipe 6 sock 7
May 22 17:21:31 ttpp sshd[13170]: debug1: inetd sockets after dupping: 3, 3
May 22 17:21:31 ttpp sshd[13170]: Connection from ***.***.***.*** port 62208
May 22 17:21:31 ttpp sshd[13170]: debug1: Client protocol version 2.0; client software version PuTTY_Release_0.62
May 22 17:21:31 ttpp sshd[13170]: debug1: no match: PuTTY_Release_0.62
May 22 17:21:31 ttpp sshd[13170]: debug1: Enabling compatibility mode for protocol 2.0
May 22 17:21:31 ttpp sshd[13170]: debug1: Local version string SSH-2.0-OpenSSH_4.3
May 22 17:21:31 ttpp sshd[13171]: debug1: permanently_set_uid: 74/74
May 22 17:21:31 ttpp sshd[13171]: debug1: list_hostkey_types: ssh-rsa,ssh-dss
May 22 17:21:31 ttpp sshd[13171]: debug1: SSH2_MSG_KEXINIT sent
May 22 17:21:31 ttpp sshd[13171]: debug1: SSH2_MSG_KEXINIT received
May 22 17:21:31 ttpp sshd[13171]: debug1: kex: client->server aes256-ctr hmac-sha1 none
May 22 17:21:31 ttpp sshd[13171]: debug1: kex: server->client aes256-ctr hmac-sha1 none
May 22 17:21:31 ttpp sshd[13171]: debug1: SSH2_MSG_KEX_DH_GEX_REQUEST_OLD received
May 22 17:21:31 ttpp sshd[13171]: debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
May 22 17:21:31 ttpp sshd[13171]: debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
May 22 17:21:31 ttpp sshd[13171]: debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
May 22 17:21:31 ttpp sshd[13171]: debug1: SSH2_MSG_NEWKEYS sent
May 22 17:21:31 ttpp sshd[13171]: debug1: expecting SSH2_MSG_NEWKEYS
May 22 17:21:31 ttpp sshd[13171]: debug1: SSH2_MSG_NEWKEYS received
May 22 17:21:31 ttpp sshd[13171]: debug1: KEX done
May 22 17:21:34 ttpp sshd[13171]: debug1: userauth-request for user **** service ssh-connection method none
May 22 17:21:34 ttpp sshd[13171]: debug1: attempt 0 failures 0
May 22 17:21:34 ttpp sshd[13170]: debug1: PAM: initializing for "****"
May 22 17:21:34 ttpp sshd[13170]: debug1: PAM: setting PAM_RHOST to "p37200-ipbffx02marunouchi.tokyo.ocn.ne.jp"
May 22 17:21:34 ttpp sshd[13170]: debug1: PAM: setting PAM_TTY to "ssh"
May 22 17:21:34 ttpp sshd[13171]: debug1: userauth-request for user **** service ssh-connection method gssapi-with-mic
May 22 17:21:34 ttpp sshd[13171]: debug1: attempt 1 failures 1
May 22 17:21:34 ttpp sshd[13170]: debug1: An invalid name was supplied\nHostname cannot be canonicalized\n
May 22 17:21:36 ttpp sshd[13171]: debug1: userauth-request for user **** service ssh-connection method password
May 22 17:21:36 ttpp sshd[13171]: debug1: attempt 2 failures 2
May 22 17:21:36 ttpp sshd[13170]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=p37200-ipbffx02marunouchi.tokyo.ocn.ne.jp  user=****
May 22 17:21:39 ttpp sshd[13170]: debug1: PAM: password authentication failed for ****: Authentication failure
May 22 17:21:39 ttpp sshd[13170]: Failed password for **** from ***.***.***.*** port 62208 ssh2
May 22 17:21:42 ttpp sshd[13171]: debug1: userauth-request for user **** service ssh-connection method password
May 22 17:21:42 ttpp sshd[13171]: debug1: attempt 3 failures 3
May 22 17:21:42 ttpp sshd[13170]: debug1: PAM: password authentication accepted for ****
May 22 17:21:42 ttpp sshd[13170]: debug1: do_pam_account: called
May 22 17:21:42 ttpp sshd[13170]: Accepted password for **** from ***.***.***.*** port 62208 ssh2
May 22 17:21:42 ttpp sshd[13170]: debug1: monitor_child_preauth: **** has been authenticated by privileged process
May 22 17:21:42 ttpp sshd[13170]: debug1: temporarily_use_uid: 501/10 (e=0/0)
May 22 17:21:42 ttpp sshd[13170]: debug1: ssh_gssapi_storecreds: Not a GSSAPI mechanism
May 22 17:21:42 ttpp sshd[13170]: debug1: restore_uid: 0/0
May 22 17:21:42 ttpp sshd[13170]: debug1: PAM: establishing credentials
May 22 17:21:42 ttpp sshd[13170]: pam_unix(sshd:session): session opened for user **** by (uid=0)
May 22 17:21:42 ttpp sshd[13172]: debug1: PAM: reinitializing credentials
May 22 17:21:42 ttpp sshd[13172]: debug1: permanently_set_uid: 501/10
May 22 17:21:42 ttpp sshd[13172]: debug1: Entering interactive session for SSH2.
May 22 17:21:42 ttpp sshd[13172]: debug1: server_init_dispatch_20
May 22 17:21:42 ttpp sshd[13172]: debug1: server_input_channel_open: ctype session rchan 256 win 16384 max 16384
May 22 17:21:42 ttpp sshd[13172]: debug1: input_session_request
May 22 17:21:42 ttpp sshd[13172]: debug1: channel 0: new [server-session]
May 22 17:21:42 ttpp sshd[13172]: debug1: session_new: init
May 22 17:21:42 ttpp sshd[13172]: debug1: session_new: session 0
May 22 17:21:42 ttpp sshd[13172]: debug1: session_open: channel 0
May 22 17:21:42 ttpp sshd[13172]: debug1: session_open: session 0: link with channel 0
May 22 17:21:42 ttpp sshd[13172]: debug1: server_input_channel_open: confirm session
May 22 17:21:42 ttpp sshd[13172]: debug1: server_input_channel_req: channel 0 request pty-req reply 1
May 22 17:21:42 ttpp sshd[13172]: debug1: session_by_channel: session 0 channel 0
May 22 17:21:42 ttpp sshd[13172]: debug1: session_input_channel_req: session 0 req pty-req
May 22 17:21:42 ttpp sshd[13172]: debug1: Allocating pty.
May 22 17:21:42 ttpp sshd[13170]: debug1: session_new: init
May 22 17:21:42 ttpp sshd[13170]: debug1: session_new: session 0
May 22 17:21:42 ttpp sshd[13170]: debug1: user_context: user_u:system_r:unconfined_t old_tty_context: user_u:object_r:devpts_t
May 22 17:21:42 ttpp sshd[13172]: debug1: session_pty_req: session 0 alloc /dev/pts/5
May 22 17:21:42 ttpp sshd[13172]: debug1: server_input_channel_req: channel 0 request shell reply 1
May 22 17:21:42 ttpp sshd[13172]: debug1: session_by_channel: session 0 channel 0
May 22 17:21:42 ttpp sshd[13172]: debug1: session_input_channel_req: session 0 req shell
May 22 17:21:42 ttpp sshd[13173]: debug1: Setting controlling tty using TIOCSCTTY.
May 22 17:21:44 ttpp sshd[13172]: debug1: server_input_channel_req: channel 0 request window-change reply 0
May 22 17:21:44 ttpp sshd[13172]: debug1: session_by_channel: session 0 channel 0
May 22 17:21:44 ttpp sshd[13172]: debug1: session_input_channel_req: session 0 req window-change
May 22 17:22:10 ttpp sudo:     **** : TTY=pts/5 ; PWD=/home/**** ; USER=root ; COMMAND=/usr/bin/tail -150 /var/log/secure

操作系统:centos 5

有任何想法吗 ?

谢谢 !

答案1

为什么要这样做而不是Port 55555在配置文件中设置/etc/ssh/sshd_config?这是安全问题还是资源问题?

答案2

我将在 /etc/ssh/sshd_config 中将日志级别切换为 DEBUG,尝试再次登录,然后检查 /var/log/auth(或 /var/log/secure)以查看错误。

相关内容