SSH - what is the differnence between authorized_keys and authorized_keys2

简介

最近从IDC接收了一批服务器,部署公钥的时候,同事说得放在authorized_keys2里面,现在闲来无事,登录服务器查看,是不是/etc/ssh/sshd_config里面配置了authorized_keys2 .但是结果令我吃惊,没有任何配置. 难道是在/root/.sshd里面配置的么, 可是也没有找到. So, 开始google. 确实有所发现.

这里写图片描述

我的理解是:
1. 在openssh 2.0的时候,启用了authorized_keys2
2. 在openssh 3.0的时候,进行了降级,仍旧使用authorized_keys
3. 目前openssh的版本已经是 5.3p1 104.el6_6.1, 所以还是authorized_keys 是正规的
4. 之所以还保留authorized_keys2,是为了向后兼容

以上仅仅是个人的理解, 有不属实的问题.

Connecting... root@coder:~# apt-get update 命中:1 http://repo.huaweicloud.com/ubuntu bionic InRelease 获取:2 http://repo.huaweicloud.com/ubuntu bionic-security InRelease [102 kB] 获取:3 http://repo.huaweicloud.com/ubuntu bionic-updates InRelease [102 kB] 获取:4 https://dl.google.com/linux/chrome/deb stable InRelease [1,825 B] 获取:5 http://repo.huaweicloud.com/ubuntu bionic-proposed InRelease [251 kB] 获取:6 http://repo.huaweicloud.com/ubuntu bionic-backports InRelease [102 kB] 获取:7 http://repo.huaweicloud.com/ubuntu bionic-security/main Sources [379 kB] 获取:8 http://repo.huaweicloud.com/ubuntu bionic-security/main amd64 Packages [3,373 kB] 错误:4 https://dl.google.com/linux/chrome/deb stable InRelease 由于没有公钥,无法验证下列签名: NO_PUBKEY 32EE5355A6BC6E42 获取:9 http://repo.huaweicloud.com/ubuntu bionic-updates/main Sources [684 kB] 获取:10 http://repo.huaweicloud.com/ubuntu bionic-updates/main amd64 Packages [3,786 kB] 获取:11 https://deb.nodesource.com/node_16.x bionic InRelease [4,584 B] 获取:12 http://repo.huaweicloud.com/ubuntu bionic-proposed/main Sources [78.3 kB] 获取:13 http://repo.huaweicloud.com/ubuntu bionic-proposed/main amd64 Packages [167 kB] 获取:14 http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic InRelease [16.2 kB] 获取:15 http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic/main amd64 Packages [2,637 B] 已下载 9,050 kB,耗时 2秒 (3,783 kB/s) 正在读取软件包列表... 完成 W: 校验数字签名时出错。此仓库未被更新,所以仍然使用此前的索引文件。GPG 错误:https://dl.google.com/linux/chrome/deb stable InRelease: 由于没有公钥,无法验证下列签名: NO_PUBKEY 32EE5355A6BC6E42 W: 无法下载 https://dl.google.com/linux/chrome/deb/dists/stable/InRelease 由于没有公钥,无法验证下列签名: NO_PUBKEY 32EE5355A6BC6E42 W: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。 root@coder:~# apt-get install ssh 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 下列软件包是自动安装的并且现在不需要了: fcitx-libs gconf-service gconf-service-backend gconf2 gconf2-common gyp javascript-common libart-2.0-2 libbonobo2-0 libbonobo2-common libbonoboui2-0 libbonoboui2-common libc-ares2 libfcitx-qt0 libgconf-2-4 libglade2-0 libgnome-2-0 libgnome-keyring-common libgnome-keyring0 libgnome2-common libgnomecanvas2-0 libgnomecanvas2-common libgnomeui-0 libgnomeui-common libgnomevfs2-0 libgnomevfs2-common libhttp-parser2.7.1 libjpeg-turbo-progs libjs-async libjs-inherits libjs-jquery libjs-node-uuid libjs-underscore liborbit-2-0 libqt5quickwidgets5 libuv1-dev miscfiles 使用'apt autoremove'来卸载它(它们)。 将会同时安装下列软件: openssh-client openssh-server openssh-sftp-server 建议安装: keychain libpam-ssh monkeysphere ssh-askpass molly-guard rssh ufw 下列软件包将被升级: openssh-client openssh-server openssh-sftp-server ssh 升级了 4 个软件包,新安装了 0 个软件包, 要卸载 0 个软件包,有 307 个软件包未被升级。 需要下载 993 kB 的归档。 解压缩后会消耗 0 B 的额外空间。 您希望继续执行吗? [Y/n] Y 获取:1 http://repo.huaweicloud.com/ubuntu bionic-updates/main amd64 openssh-sftp-server amd64 1:7.6p1-4ubuntu0.7 [45.5 kB] 获取:2 http://repo.huaweicloud.com/ubuntu bionic-updates/main amd64 openssh-server amd64 1:7.6p1-4ubuntu0.7 [332 kB] 获取:3 http://repo.huaweicloud.com/ubuntu bionic-updates/main amd64 openssh-client amd64 1:7.6p1-4ubuntu0.7 [610 kB] 获取:4 http://repo.huaweicloud.com/ubuntu bionic-updates/main amd64 ssh all 1:7.6p1-4ubuntu0.7 [5,192 B] 已下载 993 kB,耗时 0秒 (2,319 kB/s) debconf: 因为并未安装 apt-utils,所以软件包的设定过程将被推迟 (正在读取数据库 ... 系统当前共安装有 133863 个文件和目录。) 正准备解包 .../openssh-sftp-server_1%3a7.6p1-4ubuntu0.7_amd64.deb ... 正在将 openssh-sftp-server (1:7.6p1-4ubuntu0.7) 解包到 (1:7.6p1-4ubuntu0.4) 上 ... 正准备解包 .../openssh-server_1%3a7.6p1-4ubuntu0.7_amd64.deb ... 正在将 openssh-server (1:7.6p1-4ubuntu0.7) 解包到 (1:7.6p1-4ubuntu0.4) 上 ... 正准备解包 .../openssh-client_1%3a7.6p1-4ubuntu0.7_amd64.deb ... 正在将 openssh-client (1:7.6p1-4ubuntu0.7) 解包到 (1:7.6p1-4ubuntu0.4) 上 ... 正准备解包 .../ssh_1%3a7.6p1-4ubuntu0.7_all.deb ... 正在将 ssh (1:7.6p1-4ubuntu0.7) 解包到 (1:7.6p1-4ubuntu0.4) 上 ... 正在设置 openssh-client (1:7.6p1-4ubuntu0.7) ... 正在设置 openssh-sftp-server (1:7.6p1-4ubuntu0.7) ... 正在设置 openssh-server (1:7.6p1-4ubuntu0.7) ... debconf: 无法初始化前端界面:Dialog debconf: (没有安装任何可用的对话框类程序,所以无法使用基于此种形式的界面。 at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.) debconf: 返回前端界面:Readline 正在设定 openssh-server --------------------------- A new version (/tmp/fileXMbxbs) of configuration file /etc/ssh/sshd_config is available, but the version installed currently has been locally modified. 1. install the package maintainer's version 5. show a 3-way difference between available versions 2. keep the local version currently installed 6. do a 3-way merge between available versions 3. show the differences between the versions 7. start a new shell to examine the situation 4. show a side-by-side difference between the versions What do you want to do about modified configuration file sshd_config? 2 invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of restart. 正在设置 ssh (1:7.6p1-4ubuntu0.7) ... 正在处理用于 man-db (2.8.3-2ubuntu0.1) 的触发器 ... 正在处理用于 systemd (237-3ubuntu10.33) 的触发器 ... root@coder:~# service ssh start * Starting OpenBSD Secure Shell server sshd [ OK ] root@coder:~# useradd testUser root@coder:~# passwd testUser 输入新的 UNIX 密码: 重新输入新的 UNIX 密码: passwd: password updated successfully root@coder:~# su testUser $ ssh testUser@localhost Could not create directory '/home/testUser/.ssh'. The authenticity of host 'localhost (::1)' can't be established. ECDSA key fingerprint is SHA256:w1/Pe0uYSRNBkPBOdqkE8I0HZN2GGk5x2hl+XrKP+qs. Are you sure you want to continue connecting (yes/no)? yes Failed to add the host to the list of known hosts (/home/testUser/.ssh/known_hosts). testUser@localhost's password: Could not chdir to home directory /home/testUser: No such file or directory $ cd /tmp $ touch testFile $ cd /tmp $ touch testFile $
06-07
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值