How To Get root Access To An AWS Instance At Launch
First use SSH to login as the ec2-user
:
1 2 3 4 |
ssh -i AWSKeyPair.pem ec2-user@{NewHostName} % sudo su - # |
erics@zeus:/Users/erics # ssh -i foo.pem ec2-user@thehost.foo
Last login: Tue Nov 19 20:28:19 2013 from foo.bar
__| __|_ )
_| ( / Amazon Linux AMI
___|\___|___|
https://aws.amazon.com/amazon-linux-ami/2013.09-release-notes/
No packages needed for security; 7 packages available
Run “sudo yum update” to apply all updates.
[ec2-user@xyz ~]$ sudo su –
[root@xyz ~]# cd .ssh
[root@xyz .ssh]# vim authorized_keys
[root@xyz .ssh]# vim /etc/ssh/sshd_config
[root@xyz .ssh]# ps -ef | grep sshd
root 1185 1 0 20:18 ? 00:00:00 /usr/sbin/sshd
root 1316 1185 0 20:35 ? 00:00:00 sshd: ec2-user [priv]
ec2-user 1318 1316 0 20:35 ? 00:00:00 sshd: ec2-user@pts/0
root 1362 1342 0 20:36 pts/0 00:00:00 grep sshd
[root@xyz .ssh]# kill -HUP 1185
Leave Your Comment
All fields marked with "*" are required.