I changed the router for my dedicated server from TP-Link to MikroTIK and upgraded router os to 7.8, the configuration on the host machine itself did not change, only the router was changed:
I opened port 7346, which I use instead of the standard 21 and 22 to connect to sftp and to ssh(d).
When I try to connect through the console to ssh and use the following commands:
ssh -p 7346 riven@9x.xxx.xxx.xxx
a few seconds go by and the following command pops up:
ssh: connect to host 9x.xxx.xxx.xxx.xxx port 7346: Operation timed out
Moreover, if I try to login with the command:
ssh riven@9x.xxx.xxx.xxx
the output is as follows:
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
As you can see from this message the connection when I do not specify a port explicitly happens on port 22 and connects. However it should be noted that on the host machine itself in ufw status ports 21 and 22 are blocked for any connection and the service itself is running on the machine on port 7346.
In router oc at the path Ip -> Services
In the tab ssh is defotl port 22, if you change it to 7346, in this case with an implicit port indication:
ssh riven@9x.xxx.xxx.xxx
Outputs this:
ssh: connect to host 9x.xxx.xxx.xxx.xxx port 22: Connection refused
However, if we explicitly enter the port:
ssh -p 7346 riven@9x.xxx.xxx.xxx
Outputs this:
ssh: connect to host 9x.xxx.xxx.xxx.xxx port 7346: Operation timed out
In the logs at the path: /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
The following parameters are set in ufw:
enter image description here
netstat -plant | grep :22 output:
->
ps aux | grep sshd output:
->
lsof -i output:
->
telnet localhost 7346 (21,22) output:
->
sudo systemctl status sshd output:
->
firewall mikrotik:
->
mikrotik service port:
-> https://i.stack.imgur.com/g1fyt.jpg
Finally, I would like to mention that I tried to disable the firewall simultaneously on both ubuntu (ufw) and on the router - it did NOT work. It seems that the problem is not the firewall.
I will be very grateful for help)