AWS將ec2 user改為root使用者登入

2021-09-24 15:44:02 字數 1324 閱讀 2722

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

解決此問題方法:

a、為root使用者建立密碼

[ec2-user@hostname ~]$ sudo passwd root

changing password for user root.

new password:

bad password: the password is shorter than 8 characters

retype new password:

passwd: all authentication tokens updated successfully.

b、為ec2-user使用者建立密碼

[ec2-user@hostname ~]$ su - root

password:

last login: sun jun 12 02:42:00 edt 2016 from 211.157.159.11 on pts/1

[root@hostname ~]# passwd ec2-user

changing password for user ec2-user.

new password:

bad password: the password is shorter than 8 characters

retype new password:

passwd: all authentication tokens updated successfully.

c、修改ssh配置檔案

[root@hostname ~]# vi /etc/ssh/sshd_config 

passwordauthentication yes

permitrootlogin yes

usepam no

(退出儲存:i或o進入編輯, esc退出編輯, :wq儲存退出vim)

d、修改authorized_keys檔案

sed -ri 's/^/#/;s/sleep 10"\s+/&\n/' /root/.ssh/authorized_keys
e、重啟sshd服務

service sshd restart            ##linux 7之前的版本通常使用

systemctl restart sshd.service ##linux 7之後使用(替代service、chkconfig)

AWS的EC2例項建立

在不使用aws嚮導的情況下建立乙個ec2例項 0x01 設定vpc 建立vpc 建立閘道器 建立路由表 劃分子網 檢查配置是否到新的vpc中 1.建立vpc cidr classless inter domain routing無類域間路由 改進了傳統的ipv4位址分類。傳統的ip分類將ip位址直接...

AWS系列 EC2例項映象選擇

開啟ec2控制台,點選啟動例項,選擇aws marketplace centos.org說明為centos官網映象 如下圖,這種映象是收費的映象 ubuntu映象 使用centos redhat ubuntu amazon linux windows server 在aws marketplace ...

AWS系列 EC2預設限制說明

amazon ec2 提供您可以使用的不同資源,例如例項和卷。在您建立 aws 賬戶時,aws 會針對每個區域中的這些資源設定限制。此頁面列出您在 亞太區域 東京 中的 ec2 服務限制。開啟如下圖,所選控制項 如下圖,一些常見的限制,你們可以拉到下面去看那些有限制,如果需要提高限制的話。你們就要在...