SlideShare a Scribd company logo
1 of 41
Download to read offline
First There was the
Command Line
...the first thing that Apple's hackers had done when they'd got the
MacOS up and running--probably even before they'd gotten it up and
running--was to re-create the Unix interface, so that they would be able
to get some useful work done...
-- In the Beginning was the Command Line
Neal Stephenson
http://slidesha.re/1nhg37s
Follow along...
$>mkdir -p ~/www/wp_site/news
&& wget http://wordpress.org/latest.zip
&& unzip latest.zip -d
~/www/wp_site/news
Chaining commands with &
Make news directory under /var/www/wp_site, then
download latest version of WordPress, then extract the
contents of the archive to /var/www/wp_site/news
● Developer at ServerGrove
● All around nerd
● Systems Administrator for
7 years
● @aramonc in all the places
About Me
More than 60% of all web servers use *nix
Why bother?
Debian
Ubuntu
CentOS/RHEL
SmartOS*
Servers do not use graphical interfaces
*Not really Linux, still Unix based
WordPress Powers ~19% of the web
Why bother?
Statistically more likely to be target of attack
● Increased speed & flexibility
● Muscle memory
● Large pool of freely available utilities
● *nix Command Line utilities are mostly
standard
Why bother?
What if I mess up?
Getting to the Command Line
Windows
Localhost:
Cygwin
Webhost:
SSH via PuTTY
OSX, *nix
Localhost:
Terminal, xterm, etc
Webhost:
SSH via the above
Navigating Folders = Directory Tree
Where are you right now?
$>pwd
/var/www/wp_site
Print Working Directory
● /var/www/wp_site = a path
● / not 
● Starts with / (root) = absolute
What’s in here?
$>ls
index.php wp-includes
license.txt wp-links-opml.php
readme.html wp-load.php
wp-activate.php wp-login.php
wp-admin wp-mail.php
wp-blog-header.php wp-settings.php
wp-comments-post.php wp-signup.php
wp-config-sample.php wp-trackback.php
LiSt
What’s in here?
$>ls -la
total 320
drwxr-xr-x 21 adrian_sg wheel 714 Feb 28 22:07 .
drwxr-xr-x 3 root wheel 102 Feb 28 21:57 ..
-rw-r--r--@ 1 adrian_sg wheel 640 Mar 05 20:14 .htaccess
-rw-r--r--@ 1 adrian_sg wheel 418 Sep 24 20:18 index.php
-rw-r--r--@ 1 adrian_sg wheel 19929 Jan 18 2013 license.txt
-rw-r--r--@ 1 adrian_sg wheel 7185 Jan 13 13:16 readme.html
drwxr-xr-x@ 88 adrian_sg wheel 2992 Jan 23 15:17 wp-admin
drwxr-xr-x@ 5 adrian_sg wheel 170 Jan 23 15:17 wp-content
-rw-r--r--@ 1 adrian_sg wheel 2932 Sep 24 20:18 wp-cron.php
LiSt
Moving around...
$>cd wp-admin
$>pwd
/var/www/wp_site/wp-admin
$>cd /var/www/wp_site
$>pwd
/var/www/wp_site
$>cd wp-content/themes/twentyfourteen
$>pwd
/var/www/wp_site/wp-
content/themes/twentyfourteen
Change Directory
Moving around...
$>cd ..
$>pwd
/var/www/wp_site
$>cd ~/
$>pwd
/Users/adrian_sg
$>cd -
$>pwd
/var/www/wp_site
Change Directory
Where is this thing?
$>find . -iname xml*
/var/www/wp_site/xmlrpc.php
$>find . -mtime 3
Find
. (dot) means current directory
-mtime in 24 hour increments of
modified date
Where is this thing?
$>grep theme ./*
./index.php: * wp-blog-header.php...the theme.
grep: ./wp-admin: Is a directory
./wp-settings.php:require(ABSPATH.WPINC.'/theme.php');
./wp-settings.php:do_action( 'setup_theme' );
Globally search a Regular Expression and Print
Where is this thing?
$>grep -R theme ./*
./wp-admin/update.php: $parent_file='themes.php';
./wp-admin/update.php: $submenu_file='themes.php';
./wp-admin/update.php: $nonce='install-theme_'.$theme;
Globally search a Regular Expression and Print
Can I change things?
$>ls -l
total 320
-rw-r--r--@ 1 adrian_sg wheel 418 Sep 24 20:18 index.php
-rw-r--r--@ 1 adrian_sg wheel 19929 Jan 18 2013 license.txt
-rw-r--r--@ 1 adrian_sg wheel 7185 Jan 13 13:16 readme.html
drwxr-xr-x@ 88 adrian_sg wheel 2992 Jan 23 15:17 wp-admin
drwxr-xr-x@ 5 adrian_sg wheel 170 Jan 23 15:17 wp-content
-rw-r--r--@ 1 adrian_sg wheel 2932 Sep 24 20:18 wp-cron.php
drwxr-xr-x@ 122 adrian_sg wheel 4148 Jan 23 15:17 wp-includes
-rw-r--r--@ 1 adrian_sg wheel 2359 Oct 24 18:58 wp-load.php
Owners, Groups, & Permissions
Can I change things?
Permissions
r = Read
w = Write
x = Execute (run a script or open a directory)
Three levels of permissions: Owner, Group,
Everyone else
Can I change things?
Owner = User
● Sometimes your user
● Sometimes root
● Sometimes www-data (Apache user)
Can I change things?
Group
● Permissions for a set of users
● Users have own group
● Most users only belong to own group
Can I change things?
Permissions
Owner Group EveryoneIs Dir.?
rwx r-x r-xd
$>ls -l
drwxr-xr-x@ 88 adrian_sg wheel 2992 Jan 23 15:17 wp-admin
adrian_sg wheel
How do I change this thing?
$>mkdir -p useless/stuff
$>ls -l
-rw-r--r--@ 1 adrian_sg wheel 418 Sep 24 20:18 index.php
-rw-r--r--@ 1 adrian_sg wheel 19929 Jan 18 2013 license.txt
-rw-r--r--@ 1 adrian_sg wheel 7185 Jan 13 13:16 readme.html
drwxr-xr-x 2 adrian_sg wheel 68 Mar 3 22:04 useless
-rw-r--r--@ 1 adrian_sg wheel 4892 Oct 4 10:12 wp-activate.php
MaKe DIRectory
How do I change this thing?
$>mv readme.html useless/stuff/readme
$>ls -l
-rw-r--r--@ 1 adrian_sg wheel 418 Sep 24 20:18 index.php
-rw-r--r--@ 1 adrian_sg wheel 19929 Jan 18 2013 license.txt
drwxr-xr-x 2 adrian_sg wheel 68 Mar 3 22:04 useless
-rw-r--r--@ 1 adrian_sg wheel 4892 Oct 4 10:12 wp-activate.php
MoVe
How do I change this thing?
$>cp wp-config-sample.php wp-config.php
$>ls -l
-rw-r--r--@ 1 adrian_sg wheel 4795 Sep 5 21:38 wp-comments-post.php
-rw-r--r--@ 1 adrian_sg wheel 3087 Oct 24 18:58 wp-config-sample.php
-rw-r--r--@ 1 adrian_sg wheel 3087 Mar 3 21:59 wp-config.php
drwxr-xr-x@ 5 adrian_sg wheel 170 Jan 23 15:17 wp-content
CoPy
● cp -a keeps same permissions
as original
When everything goes wrong...
$>less
/var/log/apache2/error_log
Read the log file
When everything goes wrong...
Read the log file
● (up arrow) to scroll towards the top
● (down arrow) to scroll towards the bottom
● (space) next page
● p previous page
● q(uit) to exit
● / <expression> to search for <expression>
● n to search again
But I only care about the last error...
$>tail -n 5 /var/log/apache2/error_log
[Mon Mar 03 10:28:01 2014] [notice] Digest: generating secret for digest
authentication ...
[Mon Mar 03 10:28:01 2014] [notice] Digest: done
[Mon Mar 03 10:28:01 2014] [notice] Apache/2.2.26 (Unix) DAV/2 PHP/5.5.4
mod_ssl/2.2.26 OpenSSL/0.9.8y configured -- resuming normal operations
[Mon Mar 03 13:40:08 2014] [notice] child pid 8870 exit signal Bus error (10)
[Mon Mar 03 18:02:20 2014] [notice] caught SIGTERM, shutting down
Read the last few lines of the log file
I only care about the current error...
$>tail -f /var/log/apache2/error_log
[Mon Mar 03 10:28:01 2014] [notice] Digest: generating secret for digest
authentication ...
[Mon Mar 03 10:28:01 2014] [notice] Digest: done
[Mon Mar 03 10:28:01 2014] [notice] Apache/2.2.26 (Unix) DAV/2 PHP/5.5.4
mod_ssl/2.2.26 OpenSSL/0.9.8y configured -- resuming normal operations
[Mon Mar 03 13:40:08 2014] [notice] child pid 8870 exit signal Bus error (10)
[Mon Mar 03 18:02:20 2014] [notice] caught SIGTERM, shutting down
[Mon Mar 03 20:18:01 2014] [notice] Apache/2.2.26 (Unix) DAV/2 PHP/5.5.4
mod_ssl/2.2.26 OpenSSL/0.9.8y configured -- resuming normal operations
Read the log file as it happens
● -f is interactive
● Ctrl+C to exit interactive
Who is currently on my site?
$>tail -f /var/log/apache2/*access_log
::1 - - [26/Dec/2013:09:35:23 -0500] "OPTIONS * HTTP/1.0" 200 -
127.0.0.1 - - [26/Dec/2013:09:35:34 -0500] "GET / HTTP/1.1" 200 44
127.0.0.1 - - [26/Dec/2013:09:35:34 -0500] "GET /favicon.ico HTTP/1.1" 404 209
127.0.0.1 - - [26/Dec/2013:09:36:40 -0500] "GET / HTTP/1.1" 304 -
127.0.0.1 - - [26/Dec/2013:09:36:42 -0500] "GET / HTTP/1.1" 304 -
Read the access log as it happens
How do I change this thing
$>nano wp-config.php
Nano text editor
How do I change this thing
$>nano wp-config.php
^G Get Help ^O WriteOut
^R Read File ^Y Prev Page
^K Cut Text ^C Cur Pos
^X Exit ^J Justify
^W Where Is ^V Next Page
^U UnCut Text ^T To Spell
Nano text editor
Putting it all together
$>tail -n 10000
/var/log/apache2/error_log | grep “Mar
01” | less
Deep filtering with the pipe statement
Look for any log entry that occurred on March 1st within the
last ten thousand lines of the error log and display it in a
way I can easily navigate
Putting it all together
$>mkdir -p wp-content/uploads && echo -
e "RemoveHandler .php .phtml .php3
php4nRemoveType .php .phtml .php3
php4" > wp-content/uploads/.htaccess
Creating files without a text editor
Make a new uploads directory in wp-content, then create a
.htaccess file in uploads with the contents of
“RemoveHandler .php .phtml .php3 php4
RemoveType .php .phtml .php3 php4”
Resources
● Usage Share of Server OSes
● 162,000 WP Sites Used as Bot Net
● In The Beginning Was the Command Line
● linuxcommand.org
● Command Line Mystery
● 5-Minute Essential Shell Tutorial
● PuTTY
● Cygwin
Questions?
Thank you!
http://slidesha.re/1nhg37s

More Related Content

What's hot

What is suid, sgid and sticky bit
What is suid, sgid and sticky bit  What is suid, sgid and sticky bit
What is suid, sgid and sticky bit Meenu Chopra
 
Really useful linux commands
Really useful linux commandsReally useful linux commands
Really useful linux commandsMichael J Geiser
 
Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101jelrikvh
 
Heroku Tips and Hacks
Heroku Tips and HacksHeroku Tips and Hacks
Heroku Tips and HacksLuan Nguyen
 
mapserver_install_linux
mapserver_install_linuxmapserver_install_linux
mapserver_install_linuxtutorialsruby
 
How to add user in system without useradd command
How to add user in system without useradd commandHow to add user in system without useradd command
How to add user in system without useradd commandAkshay Ithape
 
Build Moses on Ubuntu (64-bit) in VirtualBox: recorded by Aaron
Build Moses on Ubuntu (64-bit) in VirtualBox: recorded by AaronBuild Moses on Ubuntu (64-bit) in VirtualBox: recorded by Aaron
Build Moses on Ubuntu (64-bit) in VirtualBox: recorded by AaronLifeng (Aaron) Han
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Herokuronnywang_tw
 
konfigurasi freeradius + daloradius in debian 9
konfigurasi freeradius + daloradius in debian 9konfigurasi freeradius + daloradius in debian 9
konfigurasi freeradius + daloradius in debian 9Walid Umar
 
망고100 보드로 놀아보자 7
망고100 보드로 놀아보자 7망고100 보드로 놀아보자 7
망고100 보드로 놀아보자 7종인 전
 
Provisionamento orquestrado nas nuvens com Juju
Provisionamento orquestrado nas nuvens com JujuProvisionamento orquestrado nas nuvens com Juju
Provisionamento orquestrado nas nuvens com JujuThiago Rondon
 
Augeas
AugeasAugeas
Augeaslutter
 
Container Security
Container SecurityContainer Security
Container Securityamouat
 

What's hot (15)

What is suid, sgid and sticky bit
What is suid, sgid and sticky bit  What is suid, sgid and sticky bit
What is suid, sgid and sticky bit
 
Really useful linux commands
Really useful linux commandsReally useful linux commands
Really useful linux commands
 
Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101Environments line-up! Vagrant & Puppet 101
Environments line-up! Vagrant & Puppet 101
 
Heroku Tips and Hacks
Heroku Tips and HacksHeroku Tips and Hacks
Heroku Tips and Hacks
 
mapserver_install_linux
mapserver_install_linuxmapserver_install_linux
mapserver_install_linux
 
How to add user in system without useradd command
How to add user in system without useradd commandHow to add user in system without useradd command
How to add user in system without useradd command
 
Build Moses on Ubuntu (64-bit) in VirtualBox: recorded by Aaron
Build Moses on Ubuntu (64-bit) in VirtualBox: recorded by AaronBuild Moses on Ubuntu (64-bit) in VirtualBox: recorded by Aaron
Build Moses on Ubuntu (64-bit) in VirtualBox: recorded by Aaron
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
 
konfigurasi freeradius + daloradius in debian 9
konfigurasi freeradius + daloradius in debian 9konfigurasi freeradius + daloradius in debian 9
konfigurasi freeradius + daloradius in debian 9
 
망고100 보드로 놀아보자 7
망고100 보드로 놀아보자 7망고100 보드로 놀아보자 7
망고100 보드로 놀아보자 7
 
Provisionamento orquestrado nas nuvens com Juju
Provisionamento orquestrado nas nuvens com JujuProvisionamento orquestrado nas nuvens com Juju
Provisionamento orquestrado nas nuvens com Juju
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
Talk NullByteCon 2015
Talk NullByteCon 2015Talk NullByteCon 2015
Talk NullByteCon 2015
 
Augeas
AugeasAugeas
Augeas
 
Container Security
Container SecurityContainer Security
Container Security
 

Viewers also liked

Operations Support Initiatives that Drive Franchisee Engagement & Results
Operations Support Initiatives that Drive Franchisee Engagement & ResultsOperations Support Initiatives that Drive Franchisee Engagement & Results
Operations Support Initiatives that Drive Franchisee Engagement & ResultsFranConnect
 
MSA Worldwide: Field Support in Franchising
MSA Worldwide: Field Support in FranchisingMSA Worldwide: Field Support in Franchising
MSA Worldwide: Field Support in FranchisingMSAworldwide
 
Toyota marketing services
Toyota marketing servicesToyota marketing services
Toyota marketing serviceskbrel
 
Presentation on toyota motors[1]
Presentation on toyota motors[1]Presentation on toyota motors[1]
Presentation on toyota motors[1]23sakshi
 
Toyota Power Point Presentation
Toyota Power Point PresentationToyota Power Point Presentation
Toyota Power Point Presentationlaumar86
 
Marketing Strategy Of Toyota
Marketing Strategy Of Toyota Marketing Strategy Of Toyota
Marketing Strategy Of Toyota Mohammad Rayya
 
Strategic management toyota case study
Strategic management  toyota case studyStrategic management  toyota case study
Strategic management toyota case studyArio Ardianto
 
Marketing Strategies & Plans of Toyota
Marketing Strategies & Plans of ToyotaMarketing Strategies & Plans of Toyota
Marketing Strategies & Plans of ToyotaJiten Menghani
 
Toyota company
Toyota companyToyota company
Toyota companyNailaJahan
 

Viewers also liked (9)

Operations Support Initiatives that Drive Franchisee Engagement & Results
Operations Support Initiatives that Drive Franchisee Engagement & ResultsOperations Support Initiatives that Drive Franchisee Engagement & Results
Operations Support Initiatives that Drive Franchisee Engagement & Results
 
MSA Worldwide: Field Support in Franchising
MSA Worldwide: Field Support in FranchisingMSA Worldwide: Field Support in Franchising
MSA Worldwide: Field Support in Franchising
 
Toyota marketing services
Toyota marketing servicesToyota marketing services
Toyota marketing services
 
Presentation on toyota motors[1]
Presentation on toyota motors[1]Presentation on toyota motors[1]
Presentation on toyota motors[1]
 
Toyota Power Point Presentation
Toyota Power Point PresentationToyota Power Point Presentation
Toyota Power Point Presentation
 
Marketing Strategy Of Toyota
Marketing Strategy Of Toyota Marketing Strategy Of Toyota
Marketing Strategy Of Toyota
 
Strategic management toyota case study
Strategic management  toyota case studyStrategic management  toyota case study
Strategic management toyota case study
 
Marketing Strategies & Plans of Toyota
Marketing Strategies & Plans of ToyotaMarketing Strategies & Plans of Toyota
Marketing Strategies & Plans of Toyota
 
Toyota company
Toyota companyToyota company
Toyota company
 

Similar to First there was the command line

Learning the command line
Learning the command lineLearning the command line
Learning the command lineAdrian Cardenas
 
Conquering the Command Line
Conquering the Command LineConquering the Command Line
Conquering the Command LineAdrian Cardenas
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to dockerJustyna Ilczuk
 
Miscelaneous Debris
Miscelaneous DebrisMiscelaneous Debris
Miscelaneous Debrisfrewmbot
 
LogStash - Yes, logging can be awesome
LogStash - Yes, logging can be awesomeLogStash - Yes, logging can be awesome
LogStash - Yes, logging can be awesomeJames Turnbull
 
Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識維泰 蔡
 
Installing spark 2
Installing spark 2Installing spark 2
Installing spark 2Ahmed Mekawy
 
Capital onehadoopclass
Capital onehadoopclassCapital onehadoopclass
Capital onehadoopclassDoug Chang
 
Noah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsNoah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsHeroku
 
What's New in Docker 1.12 by Mike Goelzer and Andrea Luzzardi
What's New in Docker 1.12 by Mike Goelzer and Andrea LuzzardiWhat's New in Docker 1.12 by Mike Goelzer and Andrea Luzzardi
What's New in Docker 1.12 by Mike Goelzer and Andrea LuzzardiDocker, Inc.
 
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea LuzzardiWhat's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea LuzzardiMike Goelzer
 
PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22Yuya Takei
 
DCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDocker, Inc.
 

Similar to First there was the command line (20)

Learning the command line
Learning the command lineLearning the command line
Learning the command line
 
Conquering the Command Line
Conquering the Command LineConquering the Command Line
Conquering the Command Line
 
Dtalk shell
Dtalk shellDtalk shell
Dtalk shell
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Miscelaneous Debris
Miscelaneous DebrisMiscelaneous Debris
Miscelaneous Debris
 
LogStash - Yes, logging can be awesome
LogStash - Yes, logging can be awesomeLogStash - Yes, logging can be awesome
LogStash - Yes, logging can be awesome
 
Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識
 
Malcon2017
Malcon2017Malcon2017
Malcon2017
 
Installing spark 2
Installing spark 2Installing spark 2
Installing spark 2
 
vBACD - Introduction to Opscode Chef - 2/29
vBACD - Introduction to Opscode Chef - 2/29vBACD - Introduction to Opscode Chef - 2/29
vBACD - Introduction to Opscode Chef - 2/29
 
Docker practice
Docker practiceDocker practice
Docker practice
 
Capital onehadoopclass
Capital onehadoopclassCapital onehadoopclass
Capital onehadoopclass
 
Noah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsNoah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku Secrets
 
Docker, c'est bonheur !
Docker, c'est bonheur !Docker, c'est bonheur !
Docker, c'est bonheur !
 
Operation outbreak
Operation outbreakOperation outbreak
Operation outbreak
 
MySQL Monitoring 101
MySQL Monitoring 101MySQL Monitoring 101
MySQL Monitoring 101
 
What's New in Docker 1.12 by Mike Goelzer and Andrea Luzzardi
What's New in Docker 1.12 by Mike Goelzer and Andrea LuzzardiWhat's New in Docker 1.12 by Mike Goelzer and Andrea Luzzardi
What's New in Docker 1.12 by Mike Goelzer and Andrea Luzzardi
 
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea LuzzardiWhat's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
 
PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22
 
DCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker Captains
 

Recently uploaded

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 

Recently uploaded (20)

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 

First there was the command line

  • 1. First There was the Command Line ...the first thing that Apple's hackers had done when they'd got the MacOS up and running--probably even before they'd gotten it up and running--was to re-create the Unix interface, so that they would be able to get some useful work done... -- In the Beginning was the Command Line Neal Stephenson http://slidesha.re/1nhg37s
  • 2. Follow along... $>mkdir -p ~/www/wp_site/news && wget http://wordpress.org/latest.zip && unzip latest.zip -d ~/www/wp_site/news Chaining commands with & Make news directory under /var/www/wp_site, then download latest version of WordPress, then extract the contents of the archive to /var/www/wp_site/news
  • 3. ● Developer at ServerGrove ● All around nerd ● Systems Administrator for 7 years ● @aramonc in all the places About Me
  • 4. More than 60% of all web servers use *nix Why bother? Debian Ubuntu CentOS/RHEL SmartOS* Servers do not use graphical interfaces *Not really Linux, still Unix based
  • 5. WordPress Powers ~19% of the web Why bother? Statistically more likely to be target of attack
  • 6. ● Increased speed & flexibility ● Muscle memory ● Large pool of freely available utilities ● *nix Command Line utilities are mostly standard Why bother?
  • 7. What if I mess up?
  • 8.
  • 9. Getting to the Command Line Windows Localhost: Cygwin Webhost: SSH via PuTTY OSX, *nix Localhost: Terminal, xterm, etc Webhost: SSH via the above
  • 10. Navigating Folders = Directory Tree
  • 11. Where are you right now? $>pwd /var/www/wp_site Print Working Directory ● /var/www/wp_site = a path ● / not ● Starts with / (root) = absolute
  • 12. What’s in here? $>ls index.php wp-includes license.txt wp-links-opml.php readme.html wp-load.php wp-activate.php wp-login.php wp-admin wp-mail.php wp-blog-header.php wp-settings.php wp-comments-post.php wp-signup.php wp-config-sample.php wp-trackback.php LiSt
  • 13. What’s in here? $>ls -la total 320 drwxr-xr-x 21 adrian_sg wheel 714 Feb 28 22:07 . drwxr-xr-x 3 root wheel 102 Feb 28 21:57 .. -rw-r--r--@ 1 adrian_sg wheel 640 Mar 05 20:14 .htaccess -rw-r--r--@ 1 adrian_sg wheel 418 Sep 24 20:18 index.php -rw-r--r--@ 1 adrian_sg wheel 19929 Jan 18 2013 license.txt -rw-r--r--@ 1 adrian_sg wheel 7185 Jan 13 13:16 readme.html drwxr-xr-x@ 88 adrian_sg wheel 2992 Jan 23 15:17 wp-admin drwxr-xr-x@ 5 adrian_sg wheel 170 Jan 23 15:17 wp-content -rw-r--r--@ 1 adrian_sg wheel 2932 Sep 24 20:18 wp-cron.php LiSt
  • 14. Moving around... $>cd wp-admin $>pwd /var/www/wp_site/wp-admin $>cd /var/www/wp_site $>pwd /var/www/wp_site $>cd wp-content/themes/twentyfourteen $>pwd /var/www/wp_site/wp- content/themes/twentyfourteen Change Directory
  • 15. Moving around... $>cd .. $>pwd /var/www/wp_site $>cd ~/ $>pwd /Users/adrian_sg $>cd - $>pwd /var/www/wp_site Change Directory
  • 16. Where is this thing? $>find . -iname xml* /var/www/wp_site/xmlrpc.php $>find . -mtime 3 Find . (dot) means current directory -mtime in 24 hour increments of modified date
  • 17. Where is this thing? $>grep theme ./* ./index.php: * wp-blog-header.php...the theme. grep: ./wp-admin: Is a directory ./wp-settings.php:require(ABSPATH.WPINC.'/theme.php'); ./wp-settings.php:do_action( 'setup_theme' ); Globally search a Regular Expression and Print
  • 18. Where is this thing? $>grep -R theme ./* ./wp-admin/update.php: $parent_file='themes.php'; ./wp-admin/update.php: $submenu_file='themes.php'; ./wp-admin/update.php: $nonce='install-theme_'.$theme; Globally search a Regular Expression and Print
  • 19. Can I change things? $>ls -l total 320 -rw-r--r--@ 1 adrian_sg wheel 418 Sep 24 20:18 index.php -rw-r--r--@ 1 adrian_sg wheel 19929 Jan 18 2013 license.txt -rw-r--r--@ 1 adrian_sg wheel 7185 Jan 13 13:16 readme.html drwxr-xr-x@ 88 adrian_sg wheel 2992 Jan 23 15:17 wp-admin drwxr-xr-x@ 5 adrian_sg wheel 170 Jan 23 15:17 wp-content -rw-r--r--@ 1 adrian_sg wheel 2932 Sep 24 20:18 wp-cron.php drwxr-xr-x@ 122 adrian_sg wheel 4148 Jan 23 15:17 wp-includes -rw-r--r--@ 1 adrian_sg wheel 2359 Oct 24 18:58 wp-load.php Owners, Groups, & Permissions
  • 20. Can I change things? Permissions r = Read w = Write x = Execute (run a script or open a directory) Three levels of permissions: Owner, Group, Everyone else
  • 21. Can I change things? Owner = User ● Sometimes your user ● Sometimes root ● Sometimes www-data (Apache user)
  • 22. Can I change things? Group ● Permissions for a set of users ● Users have own group ● Most users only belong to own group
  • 23. Can I change things? Permissions Owner Group EveryoneIs Dir.? rwx r-x r-xd $>ls -l drwxr-xr-x@ 88 adrian_sg wheel 2992 Jan 23 15:17 wp-admin adrian_sg wheel
  • 24. How do I change this thing? $>mkdir -p useless/stuff $>ls -l -rw-r--r--@ 1 adrian_sg wheel 418 Sep 24 20:18 index.php -rw-r--r--@ 1 adrian_sg wheel 19929 Jan 18 2013 license.txt -rw-r--r--@ 1 adrian_sg wheel 7185 Jan 13 13:16 readme.html drwxr-xr-x 2 adrian_sg wheel 68 Mar 3 22:04 useless -rw-r--r--@ 1 adrian_sg wheel 4892 Oct 4 10:12 wp-activate.php MaKe DIRectory
  • 25. How do I change this thing? $>mv readme.html useless/stuff/readme $>ls -l -rw-r--r--@ 1 adrian_sg wheel 418 Sep 24 20:18 index.php -rw-r--r--@ 1 adrian_sg wheel 19929 Jan 18 2013 license.txt drwxr-xr-x 2 adrian_sg wheel 68 Mar 3 22:04 useless -rw-r--r--@ 1 adrian_sg wheel 4892 Oct 4 10:12 wp-activate.php MoVe
  • 26. How do I change this thing? $>cp wp-config-sample.php wp-config.php $>ls -l -rw-r--r--@ 1 adrian_sg wheel 4795 Sep 5 21:38 wp-comments-post.php -rw-r--r--@ 1 adrian_sg wheel 3087 Oct 24 18:58 wp-config-sample.php -rw-r--r--@ 1 adrian_sg wheel 3087 Mar 3 21:59 wp-config.php drwxr-xr-x@ 5 adrian_sg wheel 170 Jan 23 15:17 wp-content CoPy ● cp -a keeps same permissions as original
  • 27.
  • 28. When everything goes wrong... $>less /var/log/apache2/error_log Read the log file
  • 29.
  • 30. When everything goes wrong... Read the log file ● (up arrow) to scroll towards the top ● (down arrow) to scroll towards the bottom ● (space) next page ● p previous page ● q(uit) to exit ● / <expression> to search for <expression> ● n to search again
  • 31. But I only care about the last error... $>tail -n 5 /var/log/apache2/error_log [Mon Mar 03 10:28:01 2014] [notice] Digest: generating secret for digest authentication ... [Mon Mar 03 10:28:01 2014] [notice] Digest: done [Mon Mar 03 10:28:01 2014] [notice] Apache/2.2.26 (Unix) DAV/2 PHP/5.5.4 mod_ssl/2.2.26 OpenSSL/0.9.8y configured -- resuming normal operations [Mon Mar 03 13:40:08 2014] [notice] child pid 8870 exit signal Bus error (10) [Mon Mar 03 18:02:20 2014] [notice] caught SIGTERM, shutting down Read the last few lines of the log file
  • 32. I only care about the current error... $>tail -f /var/log/apache2/error_log [Mon Mar 03 10:28:01 2014] [notice] Digest: generating secret for digest authentication ... [Mon Mar 03 10:28:01 2014] [notice] Digest: done [Mon Mar 03 10:28:01 2014] [notice] Apache/2.2.26 (Unix) DAV/2 PHP/5.5.4 mod_ssl/2.2.26 OpenSSL/0.9.8y configured -- resuming normal operations [Mon Mar 03 13:40:08 2014] [notice] child pid 8870 exit signal Bus error (10) [Mon Mar 03 18:02:20 2014] [notice] caught SIGTERM, shutting down [Mon Mar 03 20:18:01 2014] [notice] Apache/2.2.26 (Unix) DAV/2 PHP/5.5.4 mod_ssl/2.2.26 OpenSSL/0.9.8y configured -- resuming normal operations Read the log file as it happens ● -f is interactive ● Ctrl+C to exit interactive
  • 33. Who is currently on my site? $>tail -f /var/log/apache2/*access_log ::1 - - [26/Dec/2013:09:35:23 -0500] "OPTIONS * HTTP/1.0" 200 - 127.0.0.1 - - [26/Dec/2013:09:35:34 -0500] "GET / HTTP/1.1" 200 44 127.0.0.1 - - [26/Dec/2013:09:35:34 -0500] "GET /favicon.ico HTTP/1.1" 404 209 127.0.0.1 - - [26/Dec/2013:09:36:40 -0500] "GET / HTTP/1.1" 304 - 127.0.0.1 - - [26/Dec/2013:09:36:42 -0500] "GET / HTTP/1.1" 304 - Read the access log as it happens
  • 34. How do I change this thing $>nano wp-config.php Nano text editor
  • 35.
  • 36. How do I change this thing $>nano wp-config.php ^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos ^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text ^T To Spell Nano text editor
  • 37. Putting it all together $>tail -n 10000 /var/log/apache2/error_log | grep “Mar 01” | less Deep filtering with the pipe statement Look for any log entry that occurred on March 1st within the last ten thousand lines of the error log and display it in a way I can easily navigate
  • 38. Putting it all together $>mkdir -p wp-content/uploads && echo - e "RemoveHandler .php .phtml .php3 php4nRemoveType .php .phtml .php3 php4" > wp-content/uploads/.htaccess Creating files without a text editor Make a new uploads directory in wp-content, then create a .htaccess file in uploads with the contents of “RemoveHandler .php .phtml .php3 php4 RemoveType .php .phtml .php3 php4”
  • 39. Resources ● Usage Share of Server OSes ● 162,000 WP Sites Used as Bot Net ● In The Beginning Was the Command Line ● linuxcommand.org ● Command Line Mystery ● 5-Minute Essential Shell Tutorial ● PuTTY ● Cygwin