暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

AWS首次登录问题及相应解决办法

Torrk 2020-11-06
1002

错误一

若出现以下错误,说明密钥权限不足

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/root/ASW.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/root/ASW.pem": bad permissions
root@3.113.21.58: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

为密钥添加权限

chmod 700 /root/ASW.pem

错误二

Please login as the user "ec2-user" rather than the user "root".

编辑 /root/.ssh/authorized_keys
 ,将 ssh-rsa
前面的内容删除。

可以在首行加上注释符 #
,将光标移到 ssh-rsa
 前面,再按回车 Enter
,这样可以防止删错,保存,重启。

允许root密码登录

  • 设置root密码

$ sudo passwd ec2-user
Changing password for user ec2-user.
New password:
Retype new password:
  • 更新 /etc/ssh/sshd_config
     文件中的 PasswordAuthentication
     参数:

PasswordAuthentication yes
  • 重新启动 SSH 服务

对于 Amazon Linux、RHEL 5 和 SUSE Linux:

sudo service sshd restart

对于 Ubuntu:

sudo service ssh restart
文章转载自Torrk,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论