authentication - ssh 密钥认证用户无法使用 apt-get 更新
问题描述
Ubuntu Linux 16.04.5
我已经为使用 PuTTY 的 SSH 密钥身份验证配置了一个服务器。对于访问服务器的用户帐户,密钥身份验证工作正常,问题是当尝试使用“ apt-get update ”时系统返回:
tornado@freeradius:~$ apt-get update
Reading package lists... Done
W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
我在多个类似主题的帖子中看到,解决方案是使用“ sudo apt-get update ”——问题是用户“tornado”没有密码。
此外,我还配置了“ sshd_config ”:
ChallengeResponseAuthentication no
PasswordAuthentication no
用户“ tornado ”是使用“ adduser tornado --disabled-password ”选项创建的,因此在尝试“ sudo apt-get update ”时,系统会提示我输入用户“tornado”不存在的密码。
" home/tornado " 的权限更改为 755 ,手头的问题没有改变,所以我恢复了CHMOD。
“ stat /home/tornado ” 输出
File: '/home/tornado'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fc00h/64512d Inode: 19267592 Links: 4
Access: (2700/drwx--S---) Uid: ( 1000/ tornado) Gid: ( 1000/ tornado)
Access: 2018-09-14 11:28:01.035536814 -0700
Modify: 2018-09-14 10:50:00.864863347 -0700
Change: 2018-09-14 11:33:13.685020607 -0700
Birth: -
“ stat /home/tornado/.ssh ” 输出
File: '/home/tornado/.ssh'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fc00h/64512d Inode: 19267599 Links: 2
Access: (2700/drwx--S---) Uid: ( 1000/ tornado) Gid: ( 1000/ tornado)
Access: 2018-09-14 11:28:01.035536814 -0700
Modify: 2018-09-14 10:44:34.251451611 -0700
Change: 2018-09-14 11:28:01.035536814 -0700
Birth: -
“ stat /home/tornado/authorized_keys ” 输出
File: '/home/tornado/.ssh/authorized_keys'
Size: 209 Blocks: 8 IO Block: 4096 regular file
Device: fc00h/64512d Inode: 19267590 Links: 1
Access: (0600/-rw-------) Uid: ( 1000/ tornado) Gid: ( 1000/ tornado)
Access: 2018-09-14 11:33:41.053150514 -0700
Modify: 2018-09-14 10:44:34.127451092 -0700
Change: 2018-09-14 11:28:01.035536814 -0700
Birth: -
用户“龙卷风”的root权限也被授予......
visudo
添加:
# User privilege specification
tornado ALL=(ALL:ALL) ALL
我还尝试了:“chown tornado:root /home/tornado”,这并没有改变情况。
解决了
向用户“ tornado ”添加了密码,这使我可以 sudo 进入提供功能的 root 用户。
解决方案
推荐阅读
- sql - 获取最高工资SQL的部门名称
- mysql - 删除没有root权限或mysql用户的MySQL8 SELECT ... INTO FILE文件
- react-native - 需要 React Native 的 Keyboard 的 removeListener 函数吗?
- legend - 我们可以在 Altair 的交互式折线图中添加交互式图例吗?
- aws-kms - 在 AWS 外部使用 KMS 公钥进行非对称加密
- java - 我可以将许多非主类的对象声明到主可执行 Java 文件以外的文件中吗?如果是这样,如何:它可以是一个类等吗?
- django - 通过模型过滤器渲染 ManyToManyField - Django:'ManyRelatedManager' 对象不可迭代
- powershell - 电子邮件正文中的 Power shell 新行
- c++ - 在 C++ 类中具有类类型属性有什么用?
- logging - Logback 过滤器不会过滤掉所需的类