Welcome - 10/28/17

ssh - start to finish

ALE - Atlanta Linux Enthusiasts

Thanks for coming out!
We are volunteers. Just some guys trying to spread Linux knowledge.

This is Our Last Session in 2017 @ KSU


Thanks for sticking around.

ssh is Amazing


ssh is enough for:

ssh is Amazing - more


ssh is enough for:

ssh really is a Swiss Army knife for system to system connectivity and access.

Keeping ssh Simple Today


ssh is a client/server system


You are the Key-Master


Push that Key to a Remote System


Never type a password to access that system again.

ssh is Picky About Permissions


Files in ~/.ssh/


$ ll .ssh
total 1140
drwx------  2 jp jp    4096 Sep 18 15:09 ./
drwxr-xr-x 60 jp jp 1126400 Oct 28 02:21 ../
-rw-------  1 jp jp    2734 May 29  2016 authorized_keys
-rw-------  1 jp jp    1845 Sep 18 15:06 config
-rw-------  1 jp jp    1675 Aug 16  2012 id_rsa
-rw-r--r--  1 jp jp     390 Aug 16  2012 id_rsa.pub
-rw-------  1 jp jp    6088 Sep 18 15:09 known_hosts
-rw-------  1 jp jp    5866 Aug 10  2015 known_hosts.old

ssh into a Server


Typing Different Userids, Ports, Odd Server Names / IP


host osmc
  hostname osmc
  user osmc
  port 22
host petes
  hostname 123.254.21.1
  user my435663
  port 2222

Break!



Break - 5 minutes

Securing ssh Access


Other ssh Commands


More on Rsync


$ rsync -avz --progress /etc/  remotesrv:/Backups/etc/

Non-trival rsync script to mirror directories:

#!/bin/bash 
EXCLUDES="--exclude .Trash-1000 --exclude lost+found --exclude ZCS-2012"
ionice rsync -av --stats --progress $EXCLUDES --delete /D/ /misc/b-D3/

sshfs


tcp-wrappers for ssh/scp/sftp


tcp-wrappers examples


$ more /etc/hosts.deny
# by default, block everything except ssh
ALL: EXCEPT sshd 172.22.22.1-99




$ more /etc/hosts.allow
# Allow ssh and NFS stuff from subnet
sshd rpcbind mountd nfsd statd lockd rquotad : 172.22.22.1-99

GUIs for sftp / rsync


Troubleshooting ssh


more

Remote Applications


Remote Desktop - x2go


x2go - Server Install


Setup ssh-server first.

sudo add-apt-repository ppa:x2go/stable
sudo apt-get update
sudo apt-get install x2goserver x2goserver-xsession

x2go - Client Install



More detailed instructions
Setup ssh-client first.

sudo add-apt-repository ppa:x2go/stable
sudo apt-get update
sudo apt-get install x2goclient

Windows needs the normal setup.exe stuff. Be certain to install the extra Fonts on Windows.

Tuning x2go


SOCKS Proxy


SOCKS Proxy Script


$ more ~/bin/fireproxy-home.sh 
#!/bin/bash

# Only start SOCKS proxy if necessary
if  [ $(ps -eaf |grep ssh |grep -c 64000) = 0 ] ; then
   # Setup SOCKS proxy through home server
   echo "Starting ssh SOCKS Proxy"
   ssh -f -C -D 64000 your-server.example.com -NT 
fi 

# Star private firejail with chromium, going through 
# just setup SOCKS proxy
echo "Starting Firejail chromium with private & proxy "
export http_proxy="socks5://localhost:64000"; 
firejail --private chromium-browser \
         --proxy-server="socks5://localhost:64000" &

Thanks / Feedback


blog.jdpfu.com