Skip to content

Instantly share code, notes, and snippets.

@nickfogle
Last active August 29, 2015 14:00
Show Gist options
  • Save nickfogle/11295497 to your computer and use it in GitHub Desktop.
Save nickfogle/11295497 to your computer and use it in GitHub Desktop.
# **AWS EC2 Instance Manager**
## Modify Key Security
>
```
chmod 600 key.pem
```
## Connect to instance
>
```
ssh -i key.pem ubuntu@ec2-xx-xxx-xxx-xxx.us-west-2.compute.amazonaws.com
```
## Setup Root User
>
```
sudo vi /etc/ssh/sshd_config
```
>
```
sudo useradd -d /home/nick -m nick
```
>
```
sudo passwd nick
```
>
```
sudo visudo
```
**After line "root ALL=(ALL:ALL) ALL", add "nick ALL=(ALL:ALL) ALL"**
>
```
sudo su -
```
>
```
service ssh restart
```
>
```
logout
```
**Login as new user and notice the default bash is gone, to fix this:**
>
```
sudo chsh -s /bin/bash
```
**if that doesn't work you'll need to edit the passwords file**
>
```
sudo su - nano /etc/passwd
```
**after your new user, add**
>
```
/bin/bash
```
## Permanently Add an Alias
>
```
nano ~/.bashrc
```
**Add alias after last line in your terminal**
**Then execute below (space between the . and ~/.bashrc.)**
>
```
. ~/.bashrc
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment