Difference between ssh_config and sshd_config

Translate the Page

When we work on Linux system, we love to play with SSH program often. We are configuring the SSH client and SSH daemon on our Linux system to make it work properly (as per our requirement). In each Linux distribution, there are 2 configuration files ssh_config and sshd_config for SSH program.
Have you ever thought, what is the difference between these 2 files?
Don’t worry!!! I will tell you the difference between ssh_config and sshd_config.



This file is for the ssh client on the host machine that you are running.
For example, if you want to ssh to another remote host machine, you use a SSH client. Every settings for this SSH client will be using ssh_config, such as port number, protocol version and encryption/MAC algorithms, etc.



This file is for the sshd daemon (the program that listens to any incoming connection request to the SSH port) on the host machine.
For example, if someone wants to connect to your host machine via SSH, their SSH client settings must match your sshd_config settings in order to communicate with you, such as port number, version and so on.


Like most of the time, we change the SSH port number for security reason. Take an example as follows:
For the SSH port number, ssh_config is manually set to be 1000 (decided by the remote host), sshd_config is set to be 5555. If anyone wants to connect to your host, they must set their SSH client port always to 1000. However, you will always use port 5555 as the default port (instead of the 22) to connect to a remote machine. If the remote machine uses another port or the standard port, you need to specify the port number in the command line, e.g., “ssh remote_host_ip -p 22”

My name is Shashank Shekhar. I am a Software Engineer, currently working in one of the leading web-hosting companies in India. I am having 2 years of experience in Linux Server Administration.

I love to work in Linux environment & love learning new things.

Powered by Facebook Comments


    • Hello Himanshu,

      Thank you for your question.

      ssh is a client, however sshd is a deamon. sshd_config is used for incoming connection whereas ssh_config is used for the outgoing connection.

      Let’s take another example:

      Suppose port 5551 is set in sshd_config and port 5555 is set in ssh_config file in your computer. So port 5551 will be used for incoming connection (when you connect to your computer from other machines) whereas, port 5555 will be used for outgoing connection (when you connect to other machines from your computer).

      If you want to give access to our server having, then all the modification will be done in sshd_config file. The file “sshd_config” is more in used than “ssh_config”.

      The file “sshd_config” will have more settings than “ssh_config” like “PermitRootLogin”, “PubkeyAuthentication”, etc. Also the settings that are present in “ssh_config” will be present in “sshd_config”, but vice-versa is not true.

      I hope this is now clear to you. If you have any further question, feel free to let me know. 🙂

Leave a Reply