Trying to remote into server with private key

Globox19

New Member
Joined
Apr 18, 2020
Messages
4
Reaction score
2
Credits
0
Hello everyone,
I'm trying to set up my first ubuntu server so as to be able to SSH into it remotely using a private key.
I have made it generate a private key using
Code:
sudo ssh-keygen
Then I assigned this key to my user account (which is a linux admin but not root)
Code:
sudo ssh-copy-id [email protected]
I have then tried to edit the sshd file using
Code:
sudo nano -w /etc/ssh/sshd config
But there is something a bit strange. In the tutorial I was following (i am very new to command line in Linux) the person was getting a lot of pre-commented code which he just had to un-comment. But for me the file seemed totally blank. I just typed in the lines that the guy was un-commenting :
Code:
Port 2222
PermitRootLogin no
PasswordAuthentication no
Then I restarted the sshd and made my server display the private key :
Code:
sudo systemctl restart sshd
sudo cat ~/.ssh/id_rsa
And deleted the private key from the server :
Code:
sudo rm ~/.ssh/id_rsa
I saved the private key to a .ppk text file, which I loaded in PuttyGen to be able to use the key conveniently with Putty to SSH into my server.
For some reason I am stuck and cannot successfully SSH into my server remotely though. I am getting this error message from Putty :
Network error : Connection refused

Could you please help me getting this to work?
 



Members online


Top