Google Cloud 终端连接

 

一. 查看VM实例名称

test@cloudshell:~ (test-206504)$ whoami
test

 

二. 本地生成密钥对

[sun@localhost]$cd ~/.ssh
[sun@localhost]$ssh-keygen -f cloudkey		#设置密码

  

修改公钥用户名

cat cloudkey.pub 

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAxxxGVBvsDfN9gyQDFXJtZjSaH3afh0YDn9v5k30xBH7meH6l+SbEZ3NHZpQ== sun@localhost

sun@localhost 改为 sun@test

 

三. 导入公钥

Google Cloud Platform --> Compute Engine --> 元数据 --> SSH密钥 --> 添加cloudkey.pub内容

 

四. 本地登录

cd ~/.ssh
ssh -i cloudkey sun@35.220.170.79
Enter passphrase for key 'cloudkey': 
Linux instance-1 4.16.0-0.bpo.1-amd64 #1 SMP Debian 4.16.5-1~bpo9+1 (2018-05-06) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Jun  8 09:31:01 2018 from 58.240.100.10
sun@instance-1:~$ 

 

 五. 密码登录

登录云服务器

vi /etc/ssh/sshd_config

PasswordAuthentication no     

发现默认是关闭密码登录的

 

参考链接

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值