初学 , 当对方给我一个 SSH Public Key 我要怎么用?

2016-03-16 10:31:03 +08:00
 icebitch

在 Github 提了个问题 , 不好解决 , 对方给了我一个 SSH Public Key , 我把这个
ssh-rsa AAAAB....
保存到 root 用户的 ~/.ssh/authorized_keys 里就可以了吗?
这个文件夹和文件都是我自己建立的 , 本来没有

还需要安装什么 Package/服务或者配置等, 对方才能登陆我的机器?
我需要提供什么其他信息给对方呢?

4560 次点击
所在节点    问与答
18 条回复
drush
2016-03-16 10:37:08 +08:00
不要给 root, 你应该新建个 user , 另外应该还要设置 permission 才能用。

BTW, 什么问题?
icebitch
2016-03-16 10:42:14 +08:00
@drush 那倒没关系 , 我学习用的机器 , 部属完就重装了 , Permission 是设置 .ssh 里的所以文件吗 , 我看人家 , 设置为 600 , 可以?
Andy1999
2016-03-16 10:42:37 +08:00
service sshd restart
就可以用私钥登录了
Andy1999
2016-03-16 10:43:03 +08:00
无节操点

肉机+1
icebitch
2016-03-16 10:47:29 +08:00
@Andy1999
# service sshd restart
sshd: unrecognized service
我试着 apt-get install sshd 但不能安装
提示
unable to locate package sshd
typcn
2016-03-16 10:55:55 +08:00
@icebitch openssh-server
icebitch
2016-03-16 11:01:12 +08:00
@typcn 谢谢 , 是说要安装这个服务吗? 他提示 , openssh-server is already the newest version
但还是无法执行 `service sshd restart `
drush
2016-03-16 11:21:10 +08:00
你的是 centos 7?
systemctl restart sshd
shiji
2016-03-16 11:27:12 +08:00
@icebitch Debian / Ubuntu 用 sudo service ssh restart
Tink
2016-03-16 11:35:30 +08:00
还要在 /etc/ssh/sshd_config 里面把证书登陆打开啊
icebitch
2016-03-16 11:43:59 +08:00
@drush
@shiji
是 Debian , 果然还是得用 service ssh restart , 谢谢!!
icebitch
2016-03-16 11:50:28 +08:00
@Tink 谢谢!
文件里第 3 行是注释的 , 我把注释去掉了
```
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
```
酱紫?~
baichi
2016-03-16 11:58:54 +08:00
楼主看看这个 man sshd_config
shiji
2016-03-16 12:10:30 +08:00
@icebitch 话说你在 Github 问了啥?允许别人 ssh 进来帮你解决这种事情听起来比较罕见啊
icebitch
2016-03-16 12:28:16 +08:00
@shiji 部署 Huginn
```
root@localhost:/home/huginn/huginn# sudo bundle exec rake production:export --trace
** Invoke production:export (first_time)
** Invoke production:check (first_time)
** Execute production:check
** Execute production:export
** Execute production:stop
Stopping huginn ...
rake aborted!
'sv stop huginn-web-1' exited with a non-zero return value: warning: huginn-web-1: unable to open supervise/ok: file does not exist
...
```
PickMio
2016-03-16 14:17:59 +08:00
Tink
2016-03-16 14:51:40 +08:00
wayslog
2016-03-16 21:00:48 +08:00
这……给你公钥的这位是缺肉鸡么……

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/263853

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX