Ubuntu Administration Memo: Essential Commands and Configuration Notes
How to Change the SSH Port
The default SSH port is 22. For security reasons, it is recommended to change the SSH port. For example, if you change it to 1980, do as follows.
- In /etc/ssh/sshd_config, change the following code...
#Port 22
- Change it to the following.
Port 1980
- If the firewall is enabled, open port 1980.
ufw allow 1980/tcp
- Restart the SSH service.
systemctl restart ssh
Set it so that the root account can access SSH
Modify the configuration file
- Open the /etc/ssh/sshd_config file with a text editor.
- In the following code...
#PermitRootLogin prohibit-password
- Remove the comment (#) and change prohibit-password to yes.
PermitRootLogin yes
Apply the settings
- If you apply the changed settings with the following command, you will be able to SSH into the root account.
# systemctl restart ssh
If you want to use the nmtui command
If you want to use the nmtui command, install the network-manager package.
# apt install network-manager
Ubuntu Server manages networks by default using the Netplan + systemd-networkd combination. On the other hand, NetworkManager is a network management tool mainly used in desktop environments.


