通过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
  • 8
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值