May 10, 2025 - 05:28
SSH Explained Through Questions Image
Server Management

SSH Explained Through Questions

Comments

In this article, I'm sharing some frequently asked questions and my answers regarding SSH. If you also have SSH-related "how-to" questions, feel free to leave a comment below.

QUESTION 1: What is SSH? ANSWER 1: SSH stands for Secure Shell, and it's a protocol used to securely access remote servers. It is widely used for remote administration and secure data transmission between two hosts by encrypting the communication.

QUESTION 2: What is the default port of the SSH protocol? ANSWER 2: By default, SSH uses port 22.

QUESTION 3: Where is the configuration file for the SSH server located? ANSWER 3: The configuration file for the SSH server is located at /etc/ssh/sshd_config.

QUESTION 4: Is it possible to change the default SSH port? ANSWER 4: Yes, it is. Everyone knows the default SSH port is 22. For security reasons, it's a good idea to change it to another available port.

How to do it? STEP 1: Login to the server as root.
STEP 2: Open the SSH config file:
# nano /etc/ssh/sshd_config
STEP 3: Search for the word Port (Use CTRL+W to search). You’ll see something like:
#Port 22
STEP 4: Remove the # at the beginning and change 22 to your desired port (for example, 3214 — just don’t forget it!).
STEP 5: Save the file (CTRL+X).
STEP 6: Restart the SSH service:
# service sshd restart

QUESTION 5: Can we disable direct root login to the server? How? ANSWER 5: Yes, you can disable root login. But first, make sure you have another user created. After login with the user, you can switch to root using su root. Important: If you disable root login without creating another user first, you won’t be able to access your server again!

Open the SSH config with the following command:

# nano /etc/ssh/sshd_config

Search for the line:

PermitRootLogin

Change its value from yes to no. After saving the file, restart the SSH service. Root login will now be disabled.


QUESTION 6: I see welcome messages when logging into some servers via SSH. How are those added? ANSWER 6: This is called a "banner". Adding it is very simple. STEP 1: Create a banner file:
# nano /root/banner.txt

Write the message you want and save the file.

STEP 2: Add the banner to the SSH config:
# nano /etc/ssh/sshd_config

Search for the Banner line, add the path to your banner file, and make sure the line is not commented (remove the # if present).

Banner /root/banner.txt
STEP 3: Restart the SSH service:
# service sshd restart

If you have more questions, feel free to drop them in the comments. I’ll be happy to help.

Good luck!

Related Articles

Comments ()

No comments yet. Be the first to comment!

Leave a Comment