root账号通过ssh登录提示 Permission denied, please try again的其他情况

root账号不能登录linux大多数情况网上已经有了,操作了一遍仍然不能解决我的问题。终于在偶尔做一次提权命令操作的时候发现了问题根源。如果你一直提示 Permission denied, please try again,网上的方案不能解决,可以参考下:
sudo -i 的时候提示sudo: /usr/bin/bash: command not found
我想起来之前在/usr/bin下确实没有bash,后来发现我机器的bash是在/bin下面。因此,要修改/etc/passwd下面的配置。
起初是下面配置,我屏蔽调了

root:x:0:0:root:/root:/usr/sbin/nologin

网上推荐的是这样的root:x:0:0:root:/root:/usr/bin/bash
我的情况应该改成root:x:0:0:root:/root:/bin/bash
当然,vim /etc/ssh/sshd_config 注释掉 #PermitRootLogin without-password,添加 PermitRootLogin yes也要配置好。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
出现 "root@hadoop102's password: Permission denied, please try again" 错误是因为root用户没有权限造成的。解决这个问题的方法是设置root用户的ssh无密码登录。首先,您需要确认是否已经安装了openssh-server,如果没有安装可以通过运行sudo apt-get install openssh-server来安装。然后,您可以按照以下步骤进行root用户的免验证登录设置: 1. 使用root用户运行ssh localhost命令来检查是否需要输入密码。如果需要输入密码,则说明没有开启ssh无密码登录。 2. 使用su命令进入root状态。 3. 运行ssh-keygen -t rsa命令生成密钥对。在生成过程中,按回车键接受默认设置。 4. 运行cat ./id_rsa.pub >> ./authorized_keys命令将公钥添加到authorized_keys文件中。 这样,您就设置了root用户的ssh无密码登录。现在您可以尝试执行start-all.sh命令并输入root密码,应该可以成功执行了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [启动hadoop时报root@localhost's password: localhost: Permission denied, please try again.错误。](https://blog.csdn.net/qq_24326765/article/details/81940094)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [root@localhost's password:localhost:permission denied,please try again](https://blog.csdn.net/qq_37437983/article/details/105491955)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法](https://download.csdn.net/download/weixin_38611877/13698405)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值