Fish in the river

Techology
  1. Main page
  2. 运维技术
  3. Linux
  4. Main content

login unbunt VPS by key-based

2025年10月20日 90hotness 0likes 0comments

one day ,when i login to my ubuntu vps. i found my vps server login two session one time by follow command.

ss -tnp | grep sshd

then ,i realize that my server has been hacked.

so , i decide to do somthing to protect my server.

the first thing is to configuremy server to use   key-based ssh login instead of  login with a username  and password method.

first, i generate the ssh key using the follow command.

ssh-keygen -t ed25519 -C "joey@itech.sh"

if you use the default settings to answer the previous question. two files will be generated in the following directory.

~/.ssh/id_ed25519 ←  (private key)
~/.ssh/id_ed25519.pub ←  (public key)

and then ,what i  need to do is upload he publick key to my server.so i use the following command to accomplish this.

ssh-copy-id root@memos.ifish.blog

in the above command , root@memos.ifish.blog is the vps server domain and username.after the command complete ,the public key will be uploaded in the vps's root directory

once you finish the ablove steps. i can login my vps server now.

but if i want to use putty to login to  my server. i need to convert the private key to a format that putty can read .

this process  is simple.so i won't want explain here.

Tag: Linux
Last updated:2025年10月20日

joey

This person is a lazy dog and has left nothing

Like
< Last article
Next article >

Comments

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
Cancel

归档

  • November 2025
  • October 2025
  • September 2025
  • August 2025
  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024

分类目录

  • C#
  • Dock
  • Esxi
  • Excel
  • Kindle
  • Linux
  • Windows
  • 生活感悟
  • 群晖
  • 运维技术

COPYRIGHT © 2024 水中小鱼. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang