githubEdit

πŸ“ΆConfiguring SSH

Now we need to configure the SSH service by editing its configuration files.

We'll use Nanoarrow-up-right as our text editor. If you prefer VIMarrow-up-right, you can install it using sudo apt install vim.

Editing SSH Configuration

  1. Edit the SSH configuration file: We need to modify /etc/ssh/sshd_config. Since this is a system file, we need root privileges. Switch to root first:

su
nano /etc/ssh/sshd_config
  1. Modify the configuration: Lines starting with # are commented out. We need to uncomment and modify the following lines:

Change the port from 22 to 4242:

Find: #Port 22 Change to: Port 4242

Disable root login via SSH:

Find: #PermitRootLogin prohibit-password Change to: PermitRootLogin no

  1. Save the changes: When finished editing, save the file and exit the editor (in Nano: Ctrl+X, then Y, then Enter).

  2. Now with the file /etc/ssh/ssh_config. (not sshd_config)

#Port 22 -> Port 4242

  1. Finally we must restart the ssh service so it can be updated. For that purpuse we will use:

and once it is done we will check the service state with:

and confirm that everything is alright.

\

Last updated