我现在是 ssh 连接 google 的 GCE(ssh -i ~/.ssh/my-ssh-key username@ip),我怎么设置,才能用这个命令 ssh username@ip 连接到 GCE 啊 ,不然我都无法用 sftp 客户端连接了。。求详细解答
|
1
我现在上传文件到服务器都是用的 sftp -i ~/.ssh/my-ssh-key username@ip 然后 put /xxx/xx /xxx/xx 太麻烦了
|
|
2
说白了我就是想通过密码远程登录
|
|
3
而我不知道怎么设置密码
|
|
vietorMar 30, 2017 via Android
4
. ssh/config
|
|
5
不需要密码,改 .ssh/config 文件把 Key 指定清楚就行了
|
|
6
@AstroProfundis 这个配置文件指的的事本地的机器上的吗?
|
|
9
自己建一个对应的文件
Host 支持通配符 * 基本上规则写成这样 Host * ServerAliveInterval 300 ServerAliveCountMax 2 IdentityFile ~/.ssh/your-ssh-key |
|
10
在 ~/.ssh/config 添加类似这样的东西
Host google-cloud HostName 8.8.8.8 User username IdentityFile ~/.ssh/google_compute_engine 然后就可以 ssh username@host 了, 如果你有用 gcloud 命令 init 大概会帮你完成这一系列事情 |
|
smilezinoMar 30, 2017
11
你也可以在 gcp 中添加你的 ssh 密钥,位置:计算引擎-元数据-ssh 密钥。如同 github 一样
|
|
watermeterMar 30, 2017 via Android
13
/etc/ssh/sshd_config
|
|
msg7086Mar 31, 2017
15
如果你没有自己的密钥的话,直接扔进去改名成 id_rsa 不就好了。
|