Skip to Content

VPS SSH 公钥之巨坑

当时在用 Digtal Ocean’s VPS 翻墙。不记得这次具体发生什么了,应该是在创建 VPS 时添加了 SSH 公钥。本以为这样就可以直接登陆,不用费心改密码、ssh-copy-id之类的;结果倒好,压根登录不了,简直是完全无法控制。

Epilogue # Preface

以后还是手动输密码的好,好歹能从 terminal 登进去, 不然出了错就只能查必应(对,连 Google 都没有)

1 Beginning

这次的问题是

$ ssh root@165.227.**.***
Connection closed by 165.227.**.*** port 22

2 Development

On Digtal Ocean, Reset root password, then Launch Console.

systemctl status sshd

Oct 16 08:59:45 openstack sshd[1214]: error: Could not load host key: /etc/ssh/ss
Oct 16 08:59:45 openstack sshd[1214]: error: Could not load host key: /etc/ssh/ss
Oct 16 08:59:45 openstack sshd[1214]: error: Could not load host key: /etc/ssh/ss

Although ssh doesn’t fail 1, you can’t log in.

3 Climax

T hanks for https://linux.cn/article-4226-1.html

sudo dpkg-reconfigure openssh-server 
# choose 'install the package maintainer's version' 
sudo systemctl restart sshd

4 Epilogue

Wa, VPS is really a fantastic tool to waste time!

5 Afterword

Then vda1 only has 2G, you must be kidding!

Fortunately, it isn’t a really hard problem, although the solution isn’t easy anyway.

sudo parted /dev/vda
# resizepart
# 1
# 20G
sudo partprobe
sudo resize2fs /dev/vda1

  1. How can it not fails, it should fail and very, very, very loudly!↩︎