Skip to content

Instantly share code, notes, and snippets.

View ddre54's full-sized avatar

David Rodas ddre54

View GitHub Profile
@ddre54
ddre54 / recover.md
Created December 1, 2022 02:34 — forked from sunapi386/recover.md
How to recover locked out AWS EC2 ssh machine

One time I accidentally messed with the /etc/passwd and locked myself out of being able to SSH into the machine. Since this is a remote machine in AWS I had no way of doing what I'd normally do. Which is attaching a keyboard and monitor and fixing this manually.

To fix, use the AWS EC2 Management page to:

  • spin up a new instance of vanilla ubuntu EC2 (let's call it David)
  • shutdown the locked machine (let's call it Goliath)
  • unmount Goliath's volume
  • attach the volume to David

Then follow this guide: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html

#!/usr/bin/env ruby
# Pass in the name of the site you wich to create a cert for
domain_name = ARGV[0]
if domain_name == nil
puts "Y U No give me a domain name?"
else
system "openssl genrsa -out #{domain_name}.key 1024"
system "openssl req -new -key #{domain_name}.key -out #{domain_name}.csr -subj '/C=US/ST=NJ/L=Monroe/O=MyCompany/OU=IT/CN=#{domain_name}'"
@ddre54
ddre54 / guide.sh
Created February 4, 2014 22:14 — forked from teamon/guide.sh
Pow + nginx configuration aka give me back my 80 port! - teamon/guide.sh
# Install pow
$ curl get.pow.cx | sh
# Install powder
$ gem install powder
# See that firewall is fucked
$ sudo ipfw show
00100 0 0 fwd 127.0.0.1,20559 tcp from any to me dst-port 80 in <- THIS ONE!!!
65535 81005 28684067 allow ip from any to any