Tao SSH key tu powershell để remote ssh lên server linux

Thứ ba - 28/11/2023 10:58 184 0
dùng powershell tạo sshkey và kết nối đến máy chủ bằng SSH key
Tao SSH key tu powershell để remote ssh lên server linux

Cấu hình SSH sử dụng Pubkey để kết nối

Trên Linux Server

Chỉnh sửa file /etc/ssh/sshd_config
vi /etc/ssh/sshd_config

Bỏ dấu # ở dòng PubkeyAuthentication và AuthorizedKeysFile
PubkeyAuthentication   yes
AuthorizedKeyFile    /root/.ssh/authorized_keys


Nếu không được thêm dòng PubkeyAcceptedAlgorithms +ssh-rsa vào dưới dòng AuthorizedKeysFile      .ssh/authorized_keys .ssh/authorized_keys2
 
PS C:\Users\admin> ssh-keygen.exe
...
... 
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

PS C:\Users\admin> type C:\Users\admin\.ssh\id_rsa.pub | ssh root@10.1.18.13 'cat >> .ssh/authorized_keys'
...

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
...

SSH đến máy chủ
PS C:\Users\admin> ssh root@10.1.18.13



Khai baos Visual Studio Code private key de remote ssh

file config trong thu mục <user_profile>\.ssh
Host 10.1.18.13
  HostName 10.1.18.13
  User root
  IdentityFile ~/.ssh/id_rsa

Tạo key từ phần mềm MobarXterm


 

Tổng số điểm của bài viết là: 0 trong 0 đánh giá

Click để đánh giá bài viết
Bạn đã không sử dụng Site, Bấm vào đây để duy trì trạng thái đăng nhập. Thời gian chờ: 60 giây