Top 20 SSH interview questions and answers

In this article, you will learn about the top 20 plus SSH server interview questions and answers.

The SSH stands for Secure Shell, And it is a protocol to connect one computer from another computer securely. And It uses strong encryption to protect the information with secure communication and also make sure integrity. These are the reason which makes it more reliable.

Earlier people use telnetrlogin to connect computers, but the communication happen between computers was not secure, but SSH is the best alternative and a safe communication way. And also useful for secure transfer of files over FTP. Below you can find the top 20 ssh interview questions and answers. You can also read about the installation of ssh here.

Question 1: What is the configuration file for the SSH server?

Answer: The configuration file name for the SSH server is /etc/ssh/sshd_config.

Question 2: Where is the configuration file located for the SSH client?

Answer: The configuration file located for the SSH client is /etc/ssh/ssh_config.

Question 3: Can you tell me the standard port number for SSH?

Answer: The standard or default port number for SSH is 22.

Question 4: Is it possible to change the SSH default port?

Answer: Yes, it is possible to change the ssh default port.

Question 5: How to change the standard port of SSH?

Answer: If you want to change the standard port of SSH, then you have to edit the SSH server configuration file, which is located in /etc/ssh/sshd_config and change the value of the parameter for the Port 22 and restart the ssh service, and you have also to allow this port number in SELinux.

Question 6: How can you disable root login for SSH in Linux?

Answer: To disable the root login for ssh, you have to change the parameter in the configuration file for the root login. Open the file /etc/ssh/sshd_config with any editors and uncomment the parameter PermitRootLogin and change the value from yes to no and restart the ssh service.

Question 7: How to allow some users only to access the Linux server from ssh?

Answer: If you want to allow some users only then you can change the value for it in the configuration file. open the file /etc/ssh/sshd_config with any editors and go to the down of the configuration file and add there a line AllowUsers user_name1 user_name2 and save the file and restart the ssh service.

Question 8: Can I allow the group in SSH?

Answer: Yes, to allow any group, open the file /etc/ssh/sshd_config with any editors and go to the down of the configuration file and add there a line AllowGroups group_name1 group_name2 and save it and restart the ssh service.

Question 9: Can I deny the users or groups to access the ssh?

Answer: Yes, open the file /etc/ssh/sshd_config with any editors and go to the down of the configuration file and add there a line to deny users, DenyUsers user_name1 and for denying the group, DenyGroups group_name1 and save the file and restart the service.

Question 10: What is the difference between SSH and Telnet?

Answer:

SSH
The default port for SSH is 22
The connection between the ssh client and server is encrypted.
SSH uses a public key for authentication.
SSH is secured.
Telnet
The default port for Telnet is 23
The connection between the client and server is not encrypted.
Telnet does not use any authentication.
Telnet s not secure compared to SSH

Question 11: Can you tell me the command to check the ssh server version?

Answer: To check the ssh server version, you can use the below command.

ssh -V
ssh version
Checking ssh version

Question 12: How to enable debugging in ssh command?

Answer: If you want to enable debugging mode then you have to use switch v along with ssh command. To increase the debugging level only increase the number of v

ssh user@host v

Question 13: Which protocol does use for ssh communication?

Answer: There is two protocol. Protocol 1 and Protocol 2. If you talk about Protocol 1 then it is the older and less secure. And Protocol 2 is the latest one and it is secure.

Question 14: Can we transfer the files over ssh?

Answer: Yes, we can transfer the files or directories over ssh using scp secure copy command. For example, I have created a file with name test2 and I ‘m going to transfer this file to another server, whose IP is 192.168.43.30

$ scp source_location destination_location
$ scp /home/sahil/test2 192.168.43.30:/home/sahil
Transferring file using scp command

Question 15: Is scp command work even the standard port different?

Answer: No, it will not work. If you have changed the standard port 22 to something different then you have to put that port number while you are transferring the files or directories.

# scp -P 8012 source_location destination_location

here, -P stands for the port. and 8012 is a different port.

Question 16: Do you know blowfish in ssh?

Answer: Blowfish is used with scp command. SSH uses a triple DES cipher to encrypt the data to transfer, but if you want to increase the transfer speed then you can use blowfish.

 # scp -c blowfish source_location destination_location

Question 17: What is the use of sshpass command in Linux?

Answer: If you want to use ssh in automation then you can use sshpass.

sshpass -p password_value ssh username@hostname

Question 18: Can you tell me about ListenAddress in the ssh configuration file?

Answer: If you want to assign a particular IP address to listen then you can assign that IP. To use it. open the /etc/ssh/sshd_config file and put the value like ListenAddress 192.168.43.00 and restart the ssh service to apply it.

Question 19: What is the LoginGraceTime?

Answer: If you want to connect your server using ssh then you have only 2 minutes to complete the login. If not then the connection will not establish and you have to try again. You can increase or decrease this time in the ssh configuration file. By default, it is 2 minutes.

LoginGraceTime 2m

Question 20: How to create a banner to display texts when logging into the server via SSH?

Answer: To create a banner to display text when logging into the server via ssh, you have to create a banner file and put that location into the configuration file.

Step 1: Login into the server
Step 2: Create a file with a banner text which you want to show.

vi /etc/ssh/sshdisplaybanner.txt

Type the message which you want here and save it.
Step 3: Open /etc/ssh/sshd_config file and look for banner uncomment it and remove the no option from there and put the absolute path of the file which we have created, then it will look like banner /etc/ssh/sshdisplaybanner.txt
Step 4: save the config file and restart the ssh service, when anyone login next time they will see this message.

Question 21: What is the mean of SSH cipher?

Answer: Cipher is an algorithm which use to encrypt and decrypt the message.

Question 22: How many types of Cipher in SSH?

Answer: There are many ciphers supported by ssh. Some of them 3DES, Blowfish, AES, Arcfour.

Conclusion

These are the top 20 plus questions and answers for Openssh. This ssh interview questions and answers mainly based on real interviews. But, you can suggest if you have any addon question. I hope you understand, but if you have any questions, you can ask in the comment section.

So, that’s it for ssh interview questions and answers.

Leave a Reply