restart ssh and rsa key

I installed openssh serve on my computer with Ubuntu 16.04. Then I generated rsa key using the following instructions:linux rsa. I also transfered it to host as suggested in the link, though I don't understand why I need to transfer when host is my local computer.

I tried to sudo restart ssh

but got the following error message:

 restart: Unable to connect to Upstart:
Failed to connect to socket /com/ubuntu/upstart: Connection refused

Do you know what is wrong and how to fix it?

ssh localhost commands works fine.

Also where is private key and can I simply move it to computer that I will be logging from?

4

2 Answers

(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.

3

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like