About Me
• Lorna Jane Mitchell
• Web development consultant (mostly PHP)
• Trainer, speaker
• Author of PHP Master
• http://lornajane.net
Slide 3
Slide 3 text
The Plan
• SSH
• more SSH
• Some Things That Are Not FTP
Slide 4
Slide 4 text
SSH
Slide 5
Slide 5 text
What is SSH?
• SSH is Secure SHell
• used for console access to servers
• alternative to telnet
Slide 6
Slide 6 text
How To SSH
ssh [email protected]
Hostname might be an IP address, depends if you have DNS
Slide 7
Slide 7 text
SSH Clients
For any *nix systems (including mac) use a terminal.
For windows, use PuTTY http://lrnja.net/QDUNqx
Slide 8
Slide 8 text
VPN
Slide 9
Slide 9 text
VPN
VPN Virtual Private Network
• connects your machine to an additional network
• gives access to local-only IPs
• may need a token as well as credentials
• be aware that ALL your traffic may get sent
• once connected, no special powers are needed
Slide 10
Slide 10 text
SSH Keys
Slide 11
Slide 11 text
Public and Private Keys
Common to use keys rather than username/password with SSH
• You generate the keys
• There will be a public key named something.pub
• And a private key called just something
• Share the public key anywhere you need access
• Guard the private key with your life
Slide 12
Slide 12 text
Sending and Storing Keys
"Shall I send over my public key?"
• Public keys are no use without private keys
• Attach public keys to email
• Or paste into textareas in forms
• Private keys are as vital as passwords
• Back them up!
• Keep a copy somewhere safe
Slide 13
Slide 13 text
Generating Keys
ssh-keygen
For windows, use PuTTYGen (http://lrnja.net/QDUNqx again)
Challenge: Generate your own public/private key pair
Slide 14
Slide 14 text
SSH Keys and GitHub
Go to edit your profile, and choose "SSH Keys" from the left
Slide 15
Slide 15 text
More SSH
Slide 16
Slide 16 text
What if you want to have more than
one key?
Slide 17
Slide 17 text
SSH Identity Files
We can specify which private key to use:
ssh -i ~/.ssh./github_rsa [email protected]
Slide 18
Slide 18 text
SSH Config
SSH has a config file. We can use this to set per-host settings.
Slide 19
Slide 19 text
Not FTP
Slide 20
Slide 20 text
Why Not FTP?
FTP has been superceeded by more secure options.
Try SFTP or SCP
• both usually available when you have SSH
• both handled by FileZilla, Transmit and other popular clients
Slide 21
Slide 21 text
SFTP
SFTP Secure File Transfer Protocol
• Secure and more robust file transfer than FTP
• Uses your SSH credentials
• URLs look like: sftp:// ...
Slide 22
Slide 22 text
SCP
SCP Secure CoPy
Command-line program - works much like cp
• Source and Target can be either local or remote
• They are of the format username@server:path/to/file
scp myfile [email protected]:myfile
scp myfile [email protected]:
Slide 23
Slide 23 text
Best Practice
Slide 24
Slide 24 text
Some Tips!
• Use version control, and deploy everything on each release
• (as an emergency fallback, back everything up first)
• Deploy as much as possible, as often as possible
• Use version control ... more on git later!