but what is the difference between those keys in both directories? I’m confused because the ones i use as a user, is in my home directory ~/.ssh, and what are the roles of the keys found in /etc/ssh ? for what purpose are they created for ?
key and pub are the private and public keys (notice the limited permissions). The ones in the home folder can be used for key/value auth or even the client on the Linux side to connect to something else.
key and pub allowing someone with the right key to log in a 'ftpuser'
-rw------- 1 ftpuser ftpuser 1.7K Nov 14 14:52 id_rsa
-rw-r--r-- 1 ftpuser ftpuser 406 Nov 14 14:52 id_rsa.pub
key and pub used for the sshd keys, the "systems" host key, you can change if you wanted.
-rw------- 1 root root 227 Aug 22 2017 ssh_host_ecdsa_key
-rw-r--r-- 1 root root 183 Aug 22 2017 ssh_host_ecdsa_key.pub
-rw-r----- 1 root ssh_keys 387 Aug 22 2017 ssh_host_ed25519_key
-rw-r--r-- 1 root root 82 Aug 22 2017 ssh_host_ed25519_key.pub
I explained what you were asking but perhaps I was not clear enough.
The local user’s directory under home is for someone using the system as a user and needs to connect somewhere else. OR it can also be used for allowing incoming connections for that specific user.
Obviously the /etc/ssh folder is for the service to mange and use as needed.