Commits

Kurt Schwehr committed ccf721a

initial version of video 20 on ssh

Comments (0)

Files changed (2)

hw/hw-3-work-log.org

   - A top level entry
   - An active day stamp without time
   - At least a day tag
-- org file must have you name in the title
+- org file must have your name in the title
 - must have org header entries for author and emacs
 - md5sum email must include the full path or ~${USER}/ in it.  e.g.
 

video/video-20-secure-shell-ssh-sftp-scp.org

++STARTUP: showall
+
+#+TITLE:     Video 20: Secure Shell
+#+AUTHOR:    Kurt Schwehr
+#+EMAIL:     schwehr@ccom.unh.edu
+#+DATE:      <2011-12-26 Mon>
+#+DESCRIPTION: Marine Research Data Manipulation and Practices
+#+KEYWORDS: emacs ssh scp sftp cron
+#+LANGUAGE:  en
+#+OPTIONS:   H:3 num:nil toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS:   TeX:t LaTeX:nil skip:t d:nil todo:t pri:nil tags:not-in-toc
+#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
+#+LINK_HOME: http://vislab-ccom.unh.edu/~schwehr/Classes/2011/esci895-researchtools/
+
+* Introduction
+
+* commands
+
+#+BEGIN_SRC sh
+ls -la | grep -i ssh
+man ssh
+hostname
+ssh researchtools.ccom.nh
+hostname
+exit
+
+ls -la | grep -i ssh
+ls -la .ssh
+
+man ssh-keygen
+ssh-keygen  # just press enter for all the questions
+cd .ssh
+less id_rsa*
+
+scp id_rsa.pub researchtools.ccom.nh:
+
+ssh researchtools.ccom.nh
+ssh localhost # create the directory
+ls -la
+ls -la .ssh
+mv id_rsa.pub .ssh/authorized_keys
+ls -la .ssh
+exit
+
+ssh researchtools.ccom.nh # now you should not have to type a password
+exit
+
+less /etc/ssh/ssh_config
+#+END_SRC
+
+#+BEGIN_SRC sh
+ssh researchtools.ccom.nh hostname
+ssh researchtools.ccom.nh "df -h ."
+ssh researchtools.ccom.nh "df -h ." 2> /dev/null
+ssh researchtools.ccom.nh "df -h ." 2> /dev/null | grep home | grep -v mapper
+#+END_SRC
+
+* cron - running commands periodically
+
+#+BEGIN_SRC sh
+export EDITOR="emacs -nw"
+man -k crontab
+man crontab
+man 5 crontab
+crontab -l
+crontab -e
+tail -f /var/log/syslog
+date --utc +%Y%m%dT%M%SZ
+date +%s # UNIX UTC timestamps are "better"
+#+END_SRC
+
+#+BEGIN_EXAMPLE 
+0-59/5 * * * * (echo -n `date +\%s`; ssh researchtools.ccom.nh "df /" 2> /dev/null | egrep -v 'mapper|Filesystem') >> /home/researchtools/disk.log
+#+END_EXAMPLE
+
+* What does a host key failure
+
+#+BEGIN_EXAMPLE 
+ssh researchtools.ccom.nh
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+The RSA host key for ccom.unh.edu has changed,
+and the key for the corresponding IP address 192.168.2.177
+is unknown. This could either mean that
+DNS SPOOFING is happening or the IP address for the host
+and its host key have changed at the same time.
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
+Someone could be eavesdropping on you right now (man-in-the-middle attack)!
+It is also possible that the RSA host key has just been changed.
+The fingerprint for the RSA key sent by the remote host is
+b0:15:9c:51:01:11:e2:dc:f7:5e:95:d4:78:01:0b:94.
+Please contact your system administrator.
+Add correct host key in /Users/schwehr/.ssh/known_hosts to get rid of this message.
+Offending key in /Users/schwehr/.ssh/known_hosts:27
+RSA host key for ccom.unh.edu has changed and you have requested strict checking.
+Host key verification failed.
+ssh_exchange_identification: Connection closed by remote host
+#+END_EXAMPLE
+
+* emacs tramp
+
+#+BEGIN_EXAMPLE 
+C-x C-f /ssh:researchtools.ccom.nh:.
+#+END_EXAMPLE