Skip to content

Instantly share code, notes, and snippets.

@combusean
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save combusean/11232415 to your computer and use it in GitHub Desktop.
Save combusean/11232415 to your computer and use it in GitHub Desktop.
Quiz 1: Ops 1 (ssh, X11, AWS, opsworks, nginx, Linux)
Explain as much as possible what's going on in the following real-world terminal session.
Guidance:
Tell us what Linux distros these might be by what their PS1 is or are based off.
What are the vars in each prompt used to produce it?
In ssh, why did we get an X11 error once and what does -C and -X do?
How could we be using X11 from an ssh session, anyways?
Given that this is a VPC, what are some tight security group rules that might have allowed these connections? Why did we use a jumphost?
What is uswest-2a? (eg, what is uswest, the 2, and the a?)
What commands are we doing automatically to add the keys and where might they live?
Explain the output at the end of cd, each column of the ls output, why we edited nginx, why we touched the file, and the arguments to ps that provided that output.
How could we have got the pid in the same line as ps execution without having to cat it and type it in again?
Advanced: This didn't work. The pid is not there anymore. Why?
(9984) [master] sean@Seans-MacBook-Pro:~/code/webserver$ ssh -CX shoran@jumphost.staging.company.com
This instance is managed with AWS OpsWorks.
###### OpsWorks Summary ######
Operating System: Ubuntu 12.04.4 LTS
OpsWorks Instance: staging-jumphost
OpsWorks Instance ID: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
OpsWorks Layers: Jumphost
OpsWorks Stack: contractor_staging
EC2 Region: us-west-2
EC2 Availability Zone: us-west-2a
EC2 Instance ID: i-XXXXXXXX
Public IP: XXX.XXX.XXX.XXX
Private IP: 10.0.0.9
VPC ID: vpc-XXXXXXXX
Subnet ID: subnet-XXXXXXXX
Visit http://aws.amazon.com/opsworks for more information.
Last login: Wed Apr 23 20:19:46 2014 from cpe42.cablecompany.com
Agent pid 21612
Identity added: /home/shoran/.ssh/id_rsa (/home/shoran/.ssh/id_rsa)
Identity added: /home/shoran/.ssh/id_rsa-uswest-2-oregon2-keypair (/home/shoran/.ssh/id_rsa-uswest-2-oregon2-keypair)
(2438) shoran@staging-gateway:~$ ssh -CX root@deployer.staging.company.com
X11 forwarding request failed on channel 0
Last login: Wed Apr 23 17:21:00 2014 from 10.0.0.9
[root@ip-10-0-1-249 ~]# cd /opt/nginx/
client_body_temp/ fastcgi_temp/ logs/ sbin/ uwsgi_temp/
conf/ html/ proxy_temp/ scgi_temp/
[root@ip-10-0-1-249 ~]# cd /opt/nginx/logs
[root@ip-10-0-1-249 logs]# ls -al
total 1380
drwxr-xr-x. 2 root root 4096 Apr 17 22:59 .
drwxr-xr-x. 11 root root 4096 Apr 3 03:15 ..
-rw-r--r--. 1 root root 703193 Apr 23 19:47 access.log
-rw-r--r--. 1 root root 689398 Apr 23 03:56 error.log
[root@ip-10-0-1-249 logs]# vi ../conf/nginx.conf
[root@ip-10-0-1-249 logs]# touch nginx.pid
[root@ip-10-0-1-249 logs]# service nginx restart
nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /opt/nginx/conf/nginx.conf test is successful
Stopping nginx: [ OK ]
Starting nginx: [ OK ]
[root@ip-10-0-1-249 logs]# ls -al
total 1384
drwxr-xr-x. 2 root root 4096 Apr 23 20:33 .
drwxr-xr-x. 11 root root 4096 Apr 3 03:15 ..
-rw-r--r--. 1 root root 703193 Apr 23 19:47 access.log
-rw-r--r--. 1 root root 692024 Apr 23 20:33 error.log
-rw-r--r--. 1 root root 6 Apr 23 20:33 nginx.pid
[root@ip-10-0-1-249 logs]# cat nginx.pid
20341
[root@ip-10-0-1-249 logs]# ps axuww |grep 20341
root 20341 0.0 0.0 53740 1296 ? Ss 20:33 0:00 nginx: master process /opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf
root 20357 0.0 0.0 103248 860 pts/2 S+ 20:33 0:00 grep 20341
[root@ip-10-0-1-249 logs]#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment