10 Useful SSH (Secure Shell) Interview Questions and Answers

Download all articles in PDF format with our TecMint Content Subscription and Linux Support Services starting at $10 per month.

Support TecMint: Did you find this tutorial helpful?. Please help to keep it alive by donating. Every cent counts! - Donate Now

Receive Your Free Complimentary eBook NOW! -

Download Free Linux eBooks

Advanced Bash-Scripting Guide
Linux Bible
A Newbie's Getting Started Guide to Linux
Introduction to Linux - A Hands on Guide

You may also like...

34 Responses

  1. Alan labastida says:

    Hello.
    I hope you can help me.
    What is the -f flag in scp?

    Thank you

    • Ravi Saive says:

      @Alan,

      There isn’t any -f switch in scp man pages, yes there is capital -F option, which is used to specify per-user configuration file for ssh.

      • Alan Labastida says:

        I found that is a undocumented option to, specified “from” (-f) and “to” (-t)

        “In all cases aside from remote-to-remote scenario the scp command processes command line options and then starts an SSH connection to the remote host. Another scp command is run on the remote side through that connection in either source or sink mode. Source mode reads files and sends them over to the other side, sink mode accepts them. Source and sink modes are triggered using -f (from) and -t (to) options, respectively. These options are for internal usage only and aren’t documented. There is also the 3rd hidden option, -d, when the target is expected to be a directory.”
        http://docstore.mik.ua/orelly/networking_2ndEd/ssh/ch03_08.htm
        And this:

        “So, how does the transfer protocol actually works? If you forget about ssh, sshd and the connection between them and concentrate only on interaction between scp in “normal” mode and scp in the sink mode, you can see the scenario like this (if you copied from remote to local the remote scp command would have been run with -f option instead of -t, denoting the source mode):”
        https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works

        • Ravi Saive says:

          @Alan,

          Thanks for the detailed information about background process of ssh and scp, very helpful, let me go through it and come back to you..

  2. Almas says:

    I face most of the problems in Linux Network commands. What are the main questions related to Networking in ssh ?

  3. Surya Mohankumar says:

    in #6. How to add welcome/warning message as soon as a user login to SSH Server?
    the command nano/etc/issue is not working, any other solution for this…
    but i am using /etc/motd for welcome/warning message

    • Avishek Kumar says:

      Seems you have not installed nano editor.
      try
      # vi /etc/issue
      [Note there is gap between vi and /etc]

  4. Markus says:

    At Debian systems the SSH config could be found at “/etc/ssh/sshd_config” not “/etc/ssh/ssh_config” this is the SSH-Client config!

  5. anon says:

    good one!

  6. naboj says:

    On Debian and most Debian-based systems like, Ubuntu the ssh server configuration is in /etc/ssh/sshd_config
    There are a lot of differences between Debian and Red Hat, but this is identical!

  7. Kai S says:

    Ref #6
    I would also like a message when i login, but I only get a message, maybe my configuration is wrong ;-)

    Ref #8
    A better way is
    grep “Failed password for” /var/log/secure
    because pipe will fork another process.

  8. BasketCase says:

    On #1 and #2, as has been said by others, the /etc/ssh/ssh_config file is the client configuration while /etc/ssh/sshd_config is the server configuration file. All distributions should have both. Debian is not special here.

    On #2 I prefer the without-password setting for PermitRootLogin. This disables password authentication for the root account but still allows root access via more secure authentication methods. Normally that means key authentication but it can also mean any other non-password authentication you have configured (such as the also previously mentioned Kerberos).

    On #4 you would only need to specify a key file to ssh-copy-id if the file is not one of the standard file names and is not loaded into an agent. Otherwise ssh-copy-id will authorize every key it can find. You should also mention how to manually authorize a key since servers often have password authentication disabled (something that should be an additional question) and therefore ssh-copy-id can’t get in to authorize your key(s).

    On #9 both sftp and rsync should also be mentioned. Both are actually superior to scp unless you need the rarely used scp -3 functionality.

  9. Jairusan says:

    Thank you Kumar, excellent article. One quick question, I was checking for the “/var/log/secure” file on my linux mint 17 Qiana and was not there. Is there a command or comment change I need to do to get SSH to start keeping logs about fail log in attempts.? Thank you in advance!

    • Jairusan says:

      Actually, I found out that in Debian based systems the “/var/log/secure” file is in “/var/log/auth.log” ^.^ Thank you!

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 95000+ Linux Users
  1. 77,543
  2. 4,213
  3. 35,218

Enter your email to get latest Linux Howto's