Secure Shell (SSH) Interview Questions & Answers

  1. Question 1. What Is Ssh Protocol?

    Answer :

    SSH, or secure shell, is a secure protocol and the most common way of safely administering remote servers. Because it encrypt data while transferring from one host to another host throughout network.

  2. Question 2. What Is The Default Port & Configuration File Of Ssh Server ?

    Answer :

    22 is default port  for ssh and  ‘/etc/ssh/sshd_config’ is the configuration file.

  3. Samba Server Interview Questions

  4. Question 3. How To Change The Default Ssh Port In Linux ?

    Answer :

    To change the port , first edit the file ‘ /etc/ssh/sshd_config ‘ , change the value of parameter ‘ port 22 ‘, now restart the ssh service.

  5. Question 4. What Is The Configuration File Of Ssh Client ?

    Answer :

    ‘ /etc/ssh/ssh_config ‘ is configuration file for ssh client.

  6. Question 5. What Is Ssh Port Forwarding?

    Answer :

    SSH Port Forwarding, sometimes called SSH Tunneling, which allows you to establish a secure SSH session and then tunnel arbitrary TCP connections through it. Tunnels can be created at any time, with almost no effort and no programming.

    Syntax : ssh -L localport:host:hostport user@ssh_server -N


    -L – port forwarding parameters

    localport – local port (chose a port that is not in use by other service)

    host – server that has the port (hostport) that you want to forward

    hostport – remote port

    -N – do not execute a remote command, (you will not have the shell, see below)

    user – user that have ssh access to the ssh server (computer)

    ssh_server – the ssh server that will be used for forwarding/tunneling

    Without the –N option you will have not only the forwarding port but also the remote shell.

  7. Question 6. How To Disable The Root Login In Linux Server ?

    Answer :

    Open the file ‘ /etc/ssh/sshd_config ‘ and change the parameter ‘PermitRootLogin yes’ to ‘PermitRootLogin no’ & restart the ssh service.

  8. Question 7. How To Allow Only Specific Users To Ssh Your Linux Server ?

    Answer :

    Open the file ‘/etc/ssh/sshd_config’ and add the parameter ‘AllowUsers user1 user2′ & then restart the ssh server.

  9. Question 8. What Is The Difference Between Ssh & Telnet ?

    Answer :

    In ssh communication between client & server is encrypted but in telnet communication between the client & server is in plain text . We can also say SSH uses a public key for authentication while Telnet does not use any authentication.SSH adds a bit more overhead to the bandwidth compared to Telnet.Default port of ssh is 22 and for telnet 23.

  10. Question 9. What Is Use Of Sshpass Command In Linux ?

    Answer :

    sshpass is a command which allows us to automatically supply password to the command prompt so that automated scripts can be run as desired by users. sshpass supplies password to ssh prompt using a dedicated tty , fooling ssh to believe that a interactive user is supplying password.

  11. Question 10. What Is The Use Of Scp Command ?

    Answer :

    SCP stands for Secure Copy ,it copies files between hosts over a  network.  It uses ssh for data transfer &  uses the same authentication and provides the same security as ssh. Unlike rcp, scp will ask for passwords or passphrases if they are needed for authentication.

  12. Question 11. What Is The Use Of Blowfish Options In Scp Command ?

    Answer :

    Using blowfish options in scp command , we can increase the speed, by default scp uses the Triple-DES cipher to encrypt the data being copied.

    Example : scp -c blowfish /home/itstuff.txt

  13. Question 12. How To Limit The Bandwidth Used By Scp Command ?

    Answer :

    We can limit the bandwidth used by the scp command using the -l option as shown in the syntax.’#scp -l bandwidth limit filename username@remote-host:/folder-name’ , where bandwidth limit is numeric to be specified in kilobits per second.

  14. Samba Server Interview Questions

  15. Question 13. How To Enable Passwordless Ssh Authentication In Linux ?

    Answer :

    To Implement passwordless or Keys based authentication we have to generate Public and Private keys , Copy the Pubic keys to remote Linux servers either manually or by ssh-copy-id command.ssh-copy-id command will automatically copy the contents of file to ‘~/.ssh/authorized_keys’ file of remote linux server.

  16. Question 14. How To Check Ssh Server’s Version ?

    Answer :

    Using the command ‘ ssh -V ‘ we can find the ssh server’s version.

  17. Question 15. Please Explain The Different Protocols For Ssh Communication?

    Answer :

    SSH has two protocols, Protocol 1 and Protocol 2. Protocol 1 is less secure and old. We use Protocol 2 now-a-days! You can set/change it from the SSH configuration file.

  18. Question 16. How To Check Ssh Server’s Version Details From Linux Commandline?

    Answer :

    You can find the SSH server version by executing the following command:

    # ssh -V


    # ssh -V

    OpenSSH_6.6.1p1, OpenSSL 1.0.1e-fips 11 Feb 2013.

  19. Question 17. What Is Abbreviated As Scp?

    Answer :

    SCP stands for Secure Copy.

  20. Question 18. Did You Hear About Blowfish?

    Answer :

    Blowfish is used with SCP command. It uses to increase the transfer speed. By default scp uses the Triple-DES cipher to encrypt the data being copied.

    Syntax: scp -c blowfish root@host:/home/crybit/* /home/crybit.

  21. Question 19. Can You Briefly Explain The Working Of Scp?

    Answer :

    SCP stands for Secure Copy. It transfer files over n/w securely. SCP is based on SSH protocol and it uses the SSH port by default.

    Working principle:

    1. Client initiates an SSH connection to the remote host, and requests an SCP process to be started on the remote host.
    2. Remote SCP process can operate in two modes.

    2.1 Source mode

    In this mode, SCP on remote host read files from HDD and send them back to the client machine.

    2.3 Sink mode

    Which accept the files sent by the client and write them to the disk on the remote host.

    Syntax is same as the base Linux copy command.

  22. Question 20. What Purpose Is Assigned For “maxauthtries?”

    Answer :

    Which defines the maximum number of allowed failed login attempt from a n/w.

  23. Question 21. How Do You Access Gui Using Ssh Connection?

    Answer :

    SSH will also support of transferring X11 forwarding, we have to use options called -XY to open server GUI app from client.