<commit_before>= Lab 00  Course setup

In this lab, you will set up the tools and access you need for the rest of the semester.

== Objectives for this lab:
* Locate and use the Blackboard collaboration tools
* Configure your terminal emulator
* Securely connect to course server via ssh and x-windows
* Collaborate and support each other.

== Prerequisites
You need access to a Windows (7 or greater), Mac OS X (10.9.5 or greater) or Ubuntu Linux machine on the St. Thomas network. It can be your machine or one of the machines in the classroom.

If you want to use a tablet, you are ON YOUR OWN. (It probably could be done - SSH & X clients exist - but I don't have the bandwidth to support it.)

Same for any other platform.

== Tasks

=== Collaborating on Blackboard

* The chat room requires an obsolete Java version, so we're not going to use it.
* The https://blackboard.stthomas.edu/webapps/blackboard/content/launchLink.jsp?course_id=_103740_1&toc_id=_491071_1&mode=cpview&mode=reset[discussion board] will be the main communication channel.
* Navigate to it and confirm you can read messages. Try posting to the "test messages" thread.

=== Setting up your terminal emulator

* Classroom machine: PuTTY and PuTTYGen should be installed
* Windows on your laptop: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html[install PuTTY and PuTTYGen] and make sure you can find the shortcuts. Putting them on your desktop is fine for now.
* On your MacOS laptop, go to Applications|Utilities|Terminal and put it in your Dock.

Advanced Windows (ON YOUR OWN): install Cygwin for SSH from command line. This allows use of command line SSH from the Windows prompt, and standard OpenSSH tools.

You may also use TeraTerm, Bitvise, or any other SSH client of your choice. You’re on your own for this.

You will be provided usernames, temporary passwords, and the server name. Use your terminal emulator to log into the server, by entering the server address, your name, and password as appropriate to PuTTy, or by simply going:

 > ssh <yourStThomasID>@<servername>

on the Mac OS.

Once you have logged in, do not type anything or "move around" in the directory structure. You should be in your home directory in a "clean," newly initialized account. Try:

 $ touch .ssh/authorized_keys

and then, only for Mac users:

 $ exit

(Windows users will need to stay logged in for the next part.)

IMPORTANT: The "$" and ">" above represent the prompt the operating system displays for you. It may have your name or other stuff before it. In rare cases, it might be a different character like "#" or even "&". In any case, you don't type the prompt character.

If there are any errors post them to the discussion room for assistance.

NOTE: You will not be able to login via password after this session. The "cleartext login" functionality in sshd_config will be https://help.ubuntu.com/community/SSH/OpenSSH/Configuring[disabled].

=== Configuring SSH - Windows

*Windows machines (both classroom machines and your laptop):* follow these instructions

http://www.ualberta.ca/CNS/RESEARCH/LinuxClusters/pka-putty.html

If you have questions, check the chat room.

=== Configuring SSH - Mac OS

IMPORTANT: On the Macintosh, be sure you are logged out of the course server. These next commands need to be performed on your local machine, while connected to the network.

If you're not already in it, bring up your Terminal application (under Applications|Utilities). *At the window for your local computer*  type:

 $ cd ~/.ssh
 $ ssh-keygen

It will suggest a name, id_rsa; that is fine.

You can enter a blank passphrase.

 $ cat id_rsa.pub

You will get output like:
```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRycwk4jklWQyzmXi/QtM6ky+85O3C5291GDCOuvzn3Q4t83Sv2wkN69aLhLk53Lfw5SU1unOWb0Cj2xi+El8D5oR+Yncovz53uqSFmiDuHKNH3bQBUS4v15n6AkJ9nqvJtJZ0iuFD1zSlP3JqeSk5e2NPCmqSbWKEOijOsGWeVHxbs2z8I5PcD2Yrd9nDwhpg84eRUHamgZvvDS83lb5A0cUK5lQXr6zinAhWsELtCZCfSOYf5gaL3ADI53hSHekDMeJvK0r+em0NLb9dwSJnJJYBJ+Eb8xhj+hSrw3pkSHGhsPYDth99vkDnPdSQNrNoVhwmJxa3T4sbLy2O+WWn xxxxxx@xxx..xxx.local
```
Copy the output to your Clipboard (highlight and Command-C). Log back into the course server with your name and password.

 $ ssh <yourStThomasID>@<servername>
 [login]

 > mkdir ~/.ssh
 > cd ~/.ssh
 > vi authorized_keys

. Press the i key to go into insert mode.

. Paste your key in with Command-V.

. Type Escape

. Type ":wq!"   (NO QUOTES)

. Now, type 'exit'.

You should now be able to log into the server by going

 ssh yourname@servername.domain

and it will NOT require a password, because you are using your key pair to authenticate.

====
*QUESTION:*

Why didn't I automate this? It would have been a simple script to set it all up in advance and provide you all your private keys. Discuss.
====

=== Configuring X windows
<commit_msg>fix Mac<commit_after>= Lab 00  Course setup

In this lab, you will set up the tools and access you need for the rest of the semester.

== Objectives for this lab:
* Locate and use the Blackboard collaboration tools
* Configure your terminal emulator
* Securely connect to course server via ssh and x-windows
* Collaborate and support each other.

== Prerequisites
You need access to a Windows (7 or greater), Mac OS X (10.9.5 or greater) or Ubuntu Linux machine on the St. Thomas network. It can be your machine or one of the machines in the classroom.

If you want to use a tablet, you are ON YOUR OWN. (It probably could be done - SSH & X clients exist - but I don't have the bandwidth to support it.)

Same for any other platform.

== Tasks

=== Collaborating on Blackboard

* The chat room requires an obsolete Java version, so we're not going to use it.
* The https://blackboard.stthomas.edu/webapps/blackboard/content/launchLink.jsp?course_id=_103740_1&toc_id=_491071_1&mode=cpview&mode=reset[discussion board] will be the main communication channel.
* Navigate to it and confirm you can read messages. Try posting to the "test messages" thread.

=== Setting up your terminal emulator

* Classroom machine: PuTTY and PuTTYGen should be installed
* Windows on your laptop: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html[install PuTTY and PuTTYGen] and make sure you can find the shortcuts. Putting them on your desktop is fine for now.
* On your MacOS laptop, go to Applications|Utilities|Terminal and put it in your Dock.

Advanced Windows (ON YOUR OWN): install Cygwin for SSH from command line. This allows use of command line SSH from the Windows prompt, and standard OpenSSH tools.

You may also use TeraTerm, Bitvise, or any other SSH client of your choice. You’re on your own for this.

You will be provided usernames, temporary passwords, and the server name. Use your terminal emulator to log into the server, by entering the server address, your name, and password as appropriate to PuTTy, or by simply going:

 > ssh <yourStThomasID>@<servername>

on the Mac OS.

Once you have logged in, do not type anything or "move around" in the directory structure. You should be in your home directory in a "clean," newly initialized account. Try:

 $ touch .ssh/authorized_keys

and then, only for Mac users:

 $ exit

(Windows users will need to stay logged in for the next part.)

IMPORTANT: The "$" and ">" above represent the prompt the operating system displays for you. It may have your name or other stuff before it. In rare cases, it might be a different character like "#" or even "&". In any case, you don't type the prompt character.

If there are any errors post them to the discussion room for assistance.

NOTE: You will not be able to login via password after this session. The "cleartext login" functionality in sshd_config will be https://help.ubuntu.com/community/SSH/OpenSSH/Configuring[disabled].

=== Configuring SSH - Windows

*Windows machines (both classroom machines and your laptop):* follow these instructions

http://www.ualberta.ca/CNS/RESEARCH/LinuxClusters/pka-putty.html

If you have questions, check the chat room.

=== Configuring SSH - Mac OS

IMPORTANT: On the Macintosh, be sure you are logged out of the course server. These next commands need to be performed on your local machine, while connected to the network.

If you're not already in it, bring up your Terminal application (under Applications|Utilities). *At the window for your local computer*  type:

 $ cd ~/.ssh
 $ ssh-keygen

It will suggest a name, id_rsa; that is fine.

You can enter a blank passphrase.

 $ cat id_rsa.pub

You will get output like:
```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRycwk4jklWQyzmXi/QtM6ky+85O3C5291GDCOuvzn3Q4t83Sv2wkN69aLhLk53Lfw5SU1unOWb0Cj2xi+El8D5oR+Yncovz53uqSFmiDuHKNH3bQBUS4v15n6AkJ9nqvJtJZ0iuFD1zSlP3JqeSk5e2NPCmqSbWKEOijOsGWeVHxbs2z8I5PcD2Yrd9nDwhpg84eRUHamgZvvDS83lb5A0cUK5lQXr6zinAhWsELtCZCfSOYf5gaL3ADI53hSHekDMeJvK0r+em0NLb9dwSJnJJYBJ+Eb8xhj+hSrw3pkSHGhsPYDth99vkDnPdSQNrNoVhwmJxa3T4sbLy2O+WWn xxxxxx@xxx..xxx.local
```
Copy the output to your Clipboard (highlight and Command-C). Log back into the course server with your name and password.

 $ ssh <yourStThomasID>@<servername>
 [login]

 > mkdir ~/.ssh
 > cd ~/.ssh
 > vi authorized_keys

. Press the i key to go into insert mode.

. Paste your key with a right click of your mouse. 

. Type Escape

. Type ":wq!"   (NO QUOTES)

. Now, type 'exit'.

You should now be able to log into the server by going

 ssh yourname@servername.domain

and it will NOT require a password, because you are using your key pair to authenticate.

====
*QUESTION:*

Why didn't I automate this? It would have been a simple script to set it all up in advance and provide you all your private keys. Discuss.
====

=== Configuring X windows

{'fraction_non_alphanumeric': 0.06526685974348366, 'fraction_numerical': 0.018204385601985933, 'mean_word_length': 4.456546275395034, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 21, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3063862', 'n_tokens_mistral': 3183, 'n_tokens_neox': 2997, 'n_words': 1327}