based on version 33
- Find interface name(e.g. enp42s0) by
$ ifconfig -a
- Make & edit the interface's config file by
$ sudo nano /etc/sysconfig/network-scripts/ifcfg-enp42s0
- put the informations by the following format:
DEVICE=enp42s0 BOOTPROTO=static ONBOOT=yes IPADDR=112.112.112.112 NETMASK=255.255.0.0 GATEWAY=119.119.119.119 DNS1=1.1.1.1 DNS2=8.8.8.8
- Restart network/NetworkManager services by:
$ su # systemctl restart network.service # systemctl restart NeworkManager.service # exit
- Open OpenSSH config by
$ sudo nano /etc/ssh/sshd_config
- Find
#Port 22
and change to desired port(e.g. 33000) by puttingPort 33000
- Find
- Allow new SSH port on SELinux
$ su # semanage port -l | grep ssh # semanage port -a -t ssh_port_t -p tcp 33000 # semanage port -l | grep ssh # systemctl restart sshd # exit $ netstat -tunl | grep 33000
- FirewallD: Open the port for your zone
- Check the active zone by ``
- Open the port in the zone by ``
- Reload
$ firewall-cmd --get-active-zones $ su # firewall-cmd --zone=FedoraServer --add-port=5000/tcp --permanent # firewall-cmd --reload # firewall-cmd --list-ports # exit
- If key exists:
- Change file/folder permissions by
$ chmod 700 ~/.ssh; chmod 600 ~/.ssh/id_ed25519; chmod 644 ~/.ssh/id_ed25519.pub
- Change file/folder permissions by
- Else:
- Create new key pair by
$ ssh-keygen -t ed25519
- Create new key pair by
- Add to authorized_keys by
$ cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys
- Optional: disable password authentication
- Open OpenSSH config by
$ sudo nano /etc/ssh/sshd_config
- Find
#PasswordAuthentication yes
and change toPasswordAuthentication no
- Open OpenSSH config by
- Static IP address using CLI
- Change SSH port
- Enable SSH key-based authentication