SSH Mastery BSD
SSH Mastery BSD
SSH Mastery BSD
OpenSSH, PuTTY,
Tunnels and Keys
Michael W Lucas
http://www.MichaelWLucas.co
!S"#an $%&$
'(out Me
'uthor
!S" pusher
irreedia(le sartass
'(out You
nae)
SSH O+er+iew
,ncryption &%&
OpenSSH Ser+er
SSH clients
SSH Keys
0 /orwardin*
#ontents 11
Port /orwardin*
Liitin* OpenSSH
OpenSSH -P2s
Security Warnin*
SSH is a tool
What is SSH)
What is OpenSSH)
SSH Ser+ers
SSH.co 44 coercial
SSH #lients
OpenSSH 3 5ni64li7e
PuTTY 44 Windows
SSH Protocol -ersions
Syetric
/ast
'syetric
slow
Pu(lic Key ,ncryption
'syetric al*orith
occasional re7eys
#ool 1s 2ot Secure
all in /etc/ssh
/etc/ssh/sshd@con.i*
run in .ore*round
1P+D
.irst4atch (asis
"eo syste:
&heel: m&l'cas
sta((: m&l'cas) *+dic+) ,-allard
s'**ort: *+dic+) m&l'cas
illin-: ,-allard
"eny !illin* People
OK:
#eny"sers ,-allard
!etter:
#eny.ro'* illin-
'llow only adins
44444.lac+helico*ters.or- 3 atches
sloth = wrath, not en+y or *luttony.
Wildcards in 2etwor7s
012.0.2.0/25 3 (y netas7
63.lac+helico*ters.or- 3 e+erythin*
thatEs not under this doain.
6l'st.lac+helico*ters.or-)3.lac+helico*ters.or-
install shell
Perissions = "irectory
static4lin7ed shell
"e+ice 2odes
pri+ile*e separation
chan*e port)
-eri.yin* Ser+er Keys
Sysadin oopsB
round4ro(in "2S)
ssh 4+ hostnae
/etc/ssh/ssh@con.i* 3 *lo(al
MHOM,/.ssh/ssh@con.i* 3 indi+idual
"ocuented in ssh@con.i*K9L
Matches
ssh aAarice.lac+helico*ters.or-
on coand line
B ssh ,er+(ace/serAer.c'stomer.com
B ssh -l ,er+(ace serAer.c'stomer.com
1n con.i* .ile
:ost serAer.c'stomer.com serAer
"ser ,er+(ace
#han*in* Port
On coand line
B ssh -* 2222 -l'ttony
1n con.i* .ile
:ost -l'ttony
Port 2222
Options on #oand Line
"ownload .ro
http://www.chiar7.*reenend.or*.u7/Rs*tatha/putty/
clic7 Sa+e
5se.ul tric7s:
"uplicate Session
Sa+ed Sessions
2ew Sessions
#han*e Settin*s
PuTTY #on.i*uration
#han*e .ilenae
B sc* data0 serAer0:data2
#han*e location:
B sc* data0 serAer0:/tm*/
S#P 111
#han*e usernaes
B scp data1 "erkface#ser!er1
?ecursi+e scp
B scp -rp $ho%e$%&lucas ser!er1
S/TP
Multiuser Machines
Sysadins
1nstall Pu(lic Key on Ser+er
MHOM,/.ssh/authoriHed@7eys
ssh4copy4id
#reate Keypair with OpenSSH
B ssh-keygen
.eneratin- *'lic/*riAate rsa +ey *air.
Gnter (ile in &hich to saAe the +ey
(/home/m&l'cas/.ssh/id@rsa):
Gnter *ass*hrase (em*ty (or no *ass*hrase): ...
Gnter same *ass*hrase a-ain: ...
8o'r identi(ication has een saAed in
/home/m&l'cas/.ssh/id@rsa.
8o'r *'lic +ey has een saAed in
/home/m&l'cas/.ssh/id@rsa.*'.
Fhe +ey (in-er*rint is: ...
5sin* SSH Key .or 'uth
clientB ssh sloth
Gnter *ass*hrase (or +ey
H/home/m&l'cas/.ssh/id@rsaH: ...
slothB
OpenSSH '*ent
#oand4line:
B ssh-agent $bin$tcsh
B ssh-add
Lo* in.
/etc/ssh/sshd@con.i*
<hallen-e=es*onseA'thentication no
Pass&ordA'thentication no
P'+eyA'thentication yes
"sePA! no
Selecti+ely 'llow Passwords
!atch Address 012.0.2.0/25
Pass&ordA'thentication yes
'*ent /orwardin*
On ser+er
Allo&A-entFor&ardin- yes
in ssh
For&ardA-ent yes
in PuTTY
in sudoers:
#e(a'lts enA@+ee* KL I%%:@A"F:@%M<CI)timestam*@timeo'tL0
,na(le on ser+er
700For&ardin- yes
#hec7 M"1SPL'Y
B echo '()*+,A-
localhost:00.0
2eed 0 ser+er
On (y de.ault
Select #onnection4QSSH4QTunnels
Select #onnection4QSSH4QTunnels
Select #onnection4QSSH4QTunnels
Po4tay4to, po4tah4to
#hoosin* 1P 'ddresses
no4a*ent4.orwardin*
no4port4.orwardin*
no40&&4.orwardin*
peritopen<J&$U.%.%.&:$9J
Keys .or 'utoated Processes