使用密碼登錄Amazon EC2

ec2:https://console.aws.amazon.com/ec2/服務器

用的是亞馬遜推薦的系統:ssh

 
建立instance後,會有一個pem的key
使用該密鑰登錄到服務器上後,默認用戶名爲
ec2-user
直接修改root密碼
$sudo passwd root
重複輸入密碼
 
而後切換到root
$su -
#
修改/etc/ssh/sshd_config
找到 PasswordAuthentication no,把no改爲yes
接下來,要從新啓動下sshd
/sbin/service sshd restart
 

再爲原來的」ec2-user」添加登陸密碼。以下命令:ide

passwd ec2-userspa

按提示,兩次輸入密碼。rest

相關文章
相關標籤/搜索