restart ssh and rsa key

Solution 1:

(Adding this as an answer from the comments)

sudo restart ssh

should be:

sudo service ssh restart

The private/public RSA SSH keys are located in ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub, respectively. You can transfer the public key to another machine to connect to it through public key authentication. This can be done via ssh-copy-id like so:

ssh-copy-id username@host

Alternatively, you can append your public key (id_rsa.pub) to the server's /home/username/.ssh/authorized_keys file, which is in essence what ssh-copy-id does.

Solution 2:

If you don't have openssh-server installed and you have made changes in you ssh_config in your system you don't have to restart the service. Just do:

ps aux | grep ssh

If the only process is /usr/bin/ssh-agent then you don't have openssh-server. openssh-server is used when someone wants to connect to your machine (ssh or sftp) and you can find it as sshd process.

Only then you can restart the sshd process with:

sudo service ssh restart