ubuntu Mikrotik SSHD错误:连接到主机9x.xxx.xxx.xxx端口7346:操作超时[关闭]

zbdgwd5y  于 2023-04-11  发布在  其他
关注(0)|答案(1)|浏览(147)

**已关闭。**此问题为not about programming or software development。当前不接受答案。

此问题似乎与a specific programming problem, a software algorithm, or software tools primarily used by programmers无关。如果您认为此问题与another Stack Exchange site主题相关,您可以留下评论以解释在何处可以回答此问题。
11小时前关闭
Improve this question
我将我的专用服务器的路由器从TP-Link改为MikroTIK,并将路由器os升级到7.8,主机本身的配置没有改变,只是路由器发生了变化:我打开了端口7346,我用它来代替标准的21和22连接到sftp和ssh(d)。当我尝试通过控制台连接到ssh并使用以下命令时:

ssh -p 7346 riven@9x.xxx.xxx.xxx

几秒钟后,弹出以下命令:

ssh: connect to host 9x.xxx.xxx.xxx.xxx port 7346: Operation timed out

此外,如果我尝试使用以下命令登录:

ssh riven@9x.xxx.xxx.xxx

输出如下:

riven@9x.xxx.xxx.xxx's password: 
Received disconnect from 9x.xxx.xxx.xxx.xxx port 22:11: auth timeout
Disconnected from 9x.xxx.xxx.xxx.xxx port 22

正如你从这个消息中看到的,当我没有明确指定端口时,连接发生在端口22上并连接。然而,应该注意的是,在ufw状态下,主机本身的端口21和22被阻止任何连接,服务本身在端口7346上运行。
在路由器oc中,路径Ip -〉Services在选项卡ssh中是defotl端口22,如果您将其更改为7346,在本例中使用隐式端口指示:

ssh riven@9x.xxx.xxx.xxx

输出如下:

ssh: connect to host 9x.xxx.xxx.xxx.xxx port 22: Connection refused

但是,如果我们显式输入端口:

ssh -p 7346 riven@9x.xxx.xxx.xxx

输出如下:

ssh: connect to host 9x.xxx.xxx.xxx.xxx port 7346: Operation timed out

在路径的日志中:/var/log/auth.log:

aNu nano onz
20:51:37 riven CRON[700]: pan_unix(cron: sesston): session closed for user root
/var /log/auth. log
Apr
Apr
Apr
Apr
Apr
Apr
Apr
Apr
Apr
Apr
Apr
Apr
Apr
Apr
9 20:51:37 riven systend-Logind[716]: Watching system buttons on /dev/Lnput/event (Power Button)
9 20:51:37 riven systend-logind[716]: Watching system buttons on /dev/input/event1 (Power Button)
9 20:51:37 riven systemd-logind[716]: Watching system buttons on /dev/Lnput/evento (Sleep Button)
9 20:51:37 riven systemd-logind[716]: Watching system buttons on /dev/input/event6 (COMPANY USB Device)
9 20:51:37 riven systend-logind[716]: Watching system buttons on /dev/Input/events (COMPANY USB Device Keyboard)
9 20:51:37 riven systemd-logind[716]: New seat seato.
9 20:51:38 riven sshd[1218]: Server listentng on 0.0.0.0 port 7346.
9 osses8 riven sshdarass Server listentno on sssdort73ab
9 20:51:38 riven gdm-launch-envtronnent]: pam_untx(gdm-launch-envtronment:sesston): sesston opened for user gd(uld-127) by (utd-0)
9 20:51:38 riven systend-logind[716]: New session c1 of user gdm.
9 20:51:38 riven systend: pan_untx(systend-user:sesston): sesston opened for user gd(utd=127) by (utd-0)
9 20:51:42 riven polkitd(authortty-local): Registered Authentication Agent for unix-session:c1 (system bus name :1.42 [/usr/btn/gnome-shell], object path /org/freedesktop
9 20:52:05 riven bus-daemon[698]: [system] Fatled to activate service 'org.bluez': timed out (service_start_tineout-25090ms)
Kit1/Authentications
9 20:53:30 riven gdm-password]: gkr-pan: unable to locate daemon control file
9 20:53:30 riven gdm-password]: gkr-pam: stashed password to try later in open session
Apr
9 20:53:30 riven gdm-password]: pan_untx(gdm-password:sesston): sesston opened for user riven (utd=1000) by (utd-0)
Apr
9 20:53:30 riven systend-Logind[716]: New sesston 3 of user riven.
Apr
9 20:53:30 riven system: pam uni(systemd-user:session): session opened for user riven(utd =1000) by (utd=0)
Apr
9 20:53:30 riven gdm-password]: gkr-pam: gnome-keyring-daemon started property and unlocked keyring
Apr
Apr
9 20:53:32 riven gnome-keyring daemon [3071]: The SSH agent was already inittalized
9 20:53:32 riven gnome-keyring-daemon[3071]: The Secret Service was already initialized
Apr
9 20:53:32 riven gnome-keyring-daemon[3071]: The PCS#11 component was already inftialized
Apr
9 20:53:33 riven polkitd(authority local): Registered Authentication Agent for unix-session:3 (systen bus nane :1.84 [/us/bin/gnome-shell], object path /org/freedesktop/PolicyKit1/AuthenticationAge
Apr
9 20:53:37 riven polkltd(authortty=local): Unregistered Authentlcatton Agent for untx-sesslon:c1 (system bus name :1.42, object path /org/freedesktop/PolicyKlt1/AuthenticattonAgent, locale en_US.UT
Apr
Apr
9 20:53:37 riven gdm-launch-envtronment]: pa_unix(gdm-launch-envtronment:session): session closed for user gdm
9 20:53:37 riven systemd-logind[716]: Sesston c1 logged out. Watting for processes to exit.
Apr
9 20:53:37 riven systend-logind[716]: Removed session c1.
Apr
Apr
9 20:53:42 riven Packageklt: uld 1000 Is trylng to obtaln org.freedesktop.packageklt.system-sources-refresh auth (only_trusted:o)
9 20:53:42 riven Packagekit: uid 1000 obtained auth for org. freedesktop .packagekit.system-sources-refresh
Apr
Apr
9 20:53:55 riven dbus-daemon[698]: [system] Falled to activate service 'org.bluez: timed out (service_start_timeout=25000ms)
9 20:54:43 riven plexec: pam unix(polkit-1:session): session opened for user root(utd=©) by (utd=1000)
Apr
9 20:54:43 riven prexec[7408]: riven: Executing command [USER-root] [TTY=unknown] [CWD=/home/riven] [COMMAND- /usr/11b/update-notifler /package-system-locked]
Apr
9 20:58:37 riven sudo:
riven : TTY=pts/0 ; PWD=/root; USER=root; COMMAND=/bin/bash
Apr
Apr
9 20:58:37 riven sudo: pan_untx(sudo-t:sesston): session opened for user root(uld=0) by (uld-1000)
9 21:06:07 riven sudo:
riven : TTY=pts/10; PWD=/root; USER=root ; COMMAND=/bin/bash
Apr
Apr
9 21:06:07 riven sudo: pan_untx(sudo-t:sesston): sesston opened for user root(uld-0) by (utd-1000)
9 21:17:01 riven CRON[10544]: pan_unix(cron:sesston): sesston opened for user root(utd-0) by (utd-0)
Apr
9 21:17:01 riven CRON[10544]: pam_unix(cron:session): session closed for user root
Apr
9 21:26:53 riven gdm-password]: gkr-pam: unlocked Login keyring
ADIS
Apr
9 21:30:01 riven CRON[11541]: pam_unix(cron:session): sesston opened for user root (utda0) by (utda0)
9 21:30:01 riven CRON[11541]: pan_untx(cron:sesston): sesston closed for user root
Apr
9 21:39:30 riven gom-password: akr-pam: untocked logn keyring
Apr
Apr
9 22:17:01 riven CRON[14547): pan_untx(cron:session): session opened for user root (utd-0) by (utd-0)
Apr
9 22:17:01 riven CRON[14547]: par_unix(cron:sesston): session closed for user root
Apr
9 22:30:01 riven CRON[15390]: pam_untx(cron:session):
sesston opened for user root(utd=0) by (utd-0)
9 22:30:01 riven CRON[15390]: pam_unix(cron: session): session closed for user root
9 22:42:45 riven gdm-password]: gkr-pam: unlocked logtn keyring

在ufw中设置以下参数:
enter image description here
netstat -plant|grep:22 output:


  • 辅助系统|grep sshd输出:

  • lsof -i输出:

  • telnet localhost 7346(21,22)输出:

  • sudo systemctl status sshd输出:

  • firewall mikrotik:

  • mikrotik服务端口:
  • https://imgur.com/a/xhfEMQt
    最后,我想提一下,我试图同时在ubuntu(ufw)和路由器上禁用防火墙-它没有工作。似乎问题不在于防火墙。
    我将非常感谢帮助)
    当我尝试通过控制台连接到ssh并使用以下命令时:
ssh -p 7346 riven@9x.xxx.xxx.xxx

几秒钟后,弹出以下命令:

ssh: connect to host 9x.xxx.xxx.xxx.xxx port 7346: Operation timed out

此外,如果我尝试使用以下命令登录:

ssh riven@9x.xxx.xxx.xxx

输出如下:

riven@9x.xxx.xxx.xxx's password: 
Received disconnect from 9x.xxx.xxx.xxx.xxx port 22:11: auth timeout
Disconnected from 9x.xxx.xxx.xxx.xxx port 22

正如你从这个消息中看到的,当我没有明确指定端口时,连接发生在端口22上并连接。然而,应该注意的是,在ufw状态下,主机本身的端口21和22被阻止任何连接,服务本身在端口7346上运行。
在路由器oc中,路径Ip -〉Services在选项卡ssh中是defotl端口22,如果您将其更改为7346,在本例中使用隐式端口指示:

ssh riven@9x.xxx.xxx.xxx

输出如下:

ssh: connect to host 9x.xxx.xxx.xxx.xxx port 22: Connection refused

但是,如果我们显式输入端口:

ssh -p 7346 riven@9x.xxx.xxx.xxx

输出如下:

ssh: connect to host 9x.xxx.xxx.xxx.xxx port 7346: Operation timed out

最后,我想提一下,我试图同时在ubuntu(ufw)和路由器上禁用防火墙-它没有工作。似乎问题不在于防火墙。

qqrboqgw

qqrboqgw1#

我通过添加IP -〉Firewall -〉NAT路径解决了这个问题:在端口转发中,我只选择in。接口:ether 1显然,如果没有这个,数据包就不能到达正确的接口,而是会到达其他接口。
enter image description here

相关问题