Kaip pakeisti numatytąjį prievado 22 SSH serverio Fedora 26

Change to root user


Edit the configuration file for the SSH server

nano /etc/ssh/sshd_config

Make the changes below to the file… Pakeitimai yra gintaro. Čia mes pašalintas # ir nurodyta numerį uostui.

# Jei norite pakeisti uostą ant SELinux sistemos, turite pasakyti
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
Port 2222
#AddressFamily any
#ListenAddress ::

Išsaugokite failą.

The port specified in the configuration file needs to be enabled in SELinux else you will get an error when restarting the SSH server service.

semanage port -a -t ssh_port_t -p tcp 2222

Restart the SSH server

service sshd restart

Kitos naudingos komandos

Install semanage command

dnf -y install policycoreutils-python


If you are using a firewall you may also need to open the port

firewall-cmd --permanent --zone=public --add-port=2222/tcp

firewall-cmd --reload

Palikite komentarą