通过ssh链接谷歌云服务器实例 google cloud compute engine
在实例-创建用户密码
创建给云服务器实例设置当前用户的密码
$ sudo passwd
# 输入新密码
在实例-设置ssh服务
打开密码授权登录
$ sudo vi /etc/ssh/sshd_config
PasswordAuthentication yes
:wq!
# 改完要重启 ssh 服务
$ sudo service sshd restart
在本地-生成ssh密钥对
$ cd ~/.ssh
$ ssh-keygen -f myKey
会生成 mykey的私钥文件和myKey.pub的公钥文件
将公钥复制到谷歌服务器实例
$ cat myKey.pub
将显示的公钥复制下来
进入谷歌云平台页面 -> 计算引擎 -> 元数据 -> SSH 密钥,粘贴保存
在本地- 使用ssh通过用户名和密码登录
$ ssh user@35.189.175.199
user@35.189.175.199's password:
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-1049-gcp x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Mon Apr 1 02:30:59 UTC 2024
System load: 0.0 Processes: 112
Usage of /: 47.1% of 9.51GB Users logged in: 1
Memory usage: 8% IPv4 address for ens4: 10.170.0.3
Swap usage: 0% IPv4 address for tun0: 10.8.0.1
* Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s
just raised the bar for easy, resilient and secure K8s cluster deployment.
https://ubuntu.com/engage/secure-kubernetes-at-the-edge
Expanded Security Maintenance for Applications is not enabled.
10 updates can be applied immediately.
To see these additional updates run: apt list --upgradable
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
New release '22.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
*** System restart required ***
Last login: Sun Oct 8 06:40:43 2017 from 115.200.175.117