UP | HOME

Class 6: Beginning Scripting (DRAFT)

Table of Contents

Introduction

Today we will

  • Emacs org-mode - Taking notes
  • How to create a script
  • Getting images from the healy
  • Homework that is due 2011-09-20 Tue 11:10

Managing passwords with KeePassX    keepassx passwords

KeyPassX is a cross platform password manager that encrypts the data before saving it to disk. You can download a Windows or Mac version of the software here. The software is already installed in your Linux virtual machine.

There are other alternatives to KeyPassX, such as 1Password. They do not support linux, but give you a web version: 1Password Support For Linux. KeyPassX is not available on the iPhone/iPad/Android devices, so if you have the Money, you might consider a tool like 1Password.

Setup KeyPassX

First add a quick link to the Panel across the top of Ubuntu. Right click on the gray bar at the top of the display and select "Add to Panel…". Double click "Application Launcher…" (the 2nd item from the top). Click the small arrow to the left of "Accessories", select KeePassX, and "Add". You can now close the "Add to Panel" tool.

Start KeePassX. Select "File" -> "New Database". You now need to create a "Master Key". This is the one password that will give you access to all the other passwords. If you forget this password, you will loose all your passwords!!!!

Save the KeePassX database! I named mine with my name. Later we will move this file to your DropBox file to share it with other computers that you use, but for now, put it in your home directory.

The program lets you organize passwords into groups. I have a number of passwords associated with CCOM systems and you do too. Let's create a group called "CCOM". "Groups" -> "Add New Group…". For title, put "CCOM". You can pick what ever icon you wish.

Select the CCOM group.

You can now create password entries for web pages, computers, and other software. I also often put license keys for software in as entries. "Entries" -> "Add New Entry"

Now create an entry for the virtual machine:

FieldValue
TitleVirtual Machine, Research Tools 2011
Usernameresearchtools
URL
Password!rt2011vm
CommentI also created my own user called ""

Now create an entry for your CCOM wiki account and your regular CCOM account.

Unique passwords for each account

You should always use a different password for each service or login system that you use. It is very hard to come up with unique passwords for each system. You also need to change your password periodically. This gets extremely challenging to do. KeyPassX can help! It has a "Generate" function to create random passwords.

Create a new entry called "test". To the right of the "Repeat" entry for passwords, there is a "Gen" button. Press that and you will see a "Password Generator" tool appear. You can control the length of the password and which characters will be in the password. The best possible password will be long and have characters from every category. Select all the types and the ensure to use all character groups check boxes. Set the password length to 25 characters. Press the eye icon to let you see the results and then press generate. You will see something like this:

Jbzc }K#/q!_ -N8c24QsS@z#

You are not going to be able to remember this password, but it is super secure. However, if you need to type the password into an iOS (iphone/ipad) or Android device, you are going to go crazy. A reasonable compromise for accounts where that is necessary is to pick lower letters and numbers with 15 characters. For example, I got:

4ox3oc2ejc7lx1u

If you will have to remember the password without KeePassX, you can pick your own password or try the "Pronouceable" tab. For example, I got:

nuOsackujBeDren

Make sure to save

After you create, modify or delete any entry, make sure to save!

Setting up drop box    cloud

Being able share files easily can make or break your work. There are many many services to automatically sync files between computers. There are many of these services:

http://en.wikipedia.org/wiki/List_of_online_backup_services

As a student at UNH, you have access to a Microsoft Live SkyDrive with 25GB of space via WildcatsMail! SkyDrive. However, this service only supports Linux via a web browser. Be warned, faculty and staff do not have access to a SkyDrive through UNH, so they might not have experience with it if you need help.

Common services that support Linux are:

One of the most popular services is DropBox. If you do not have a drop box account, you can either click this link below (this will both you and me a referal credit) or if you have someone else who can send you a referral, then you can both get a little extra free storage space over the default 2GB free account. If you have a .edu email address, be sure to use that email address as dropbox gives more space to education accounts.

Limitations of dropbox

Sadly, if you don't have internet, dropbox will not work. Even if you have multiple machines on a ship network that can talk to each other, dropbox does not currently support synchronization unless it can talk back to the company's main servers. There are other ways to share files on a ship than range from mounting network drives, to portable drives/usb sticks, and more.

It is possible that some of the OpenSource alternatives to DropBox that are being developed may become useful in restricted network environments, but I cannot yet offer any advice. See for example:

Security warning for cloud storage

Remember that this is a company storing your files on their servers. They have a privacy policy that says they will not look at your files, but that does not guarantee that they will not be hacked or that a government agency might force them to reveal your files. Additionally, it might be illegal to save certain types of data to the cloud (for example, confidential personal data or restricted data such as ITAR controlled material).

Think before putting files into a cloud drive!!!

You can encrypt data before putting into the service for extra protection. For example, KeyPassX does not store your raw passwords, so it should be safe for use with DropBox.

An example of one of the security issues:

http://it.slashdot.org/story/11/04/08/1838220/Dropbox-Authentication-Insecure-By-Design

Creating an account

This is my referral link. Please feel free to use a referral from someone else.

http://db.tt/qj5etLX

NOTE: I am not sure if it really is okay for a professor to give out a referral URL in class. If you are not comfortable with that, get a referral from someone you know has dropbox.

You can get extra space by referring other people you know (be warned that other people might not appreciate the invite). Once you have signed in, make sure to go to this address to verify that are getting credit for your educational account and to get extra free space.

https://www.dropbox.com/edu

You can pay for more space if you desire, but for this class, I am assuming that you only have the base free account. You will not need more space than that for the class.

Installing Drop Box

If dropbox is not installed in your virtual machine (my first version of the Ubuntu VM does not have dropbox), you need to install it. This is not open source software, so you will have to go through a different process for normal software in Ubuntu. First you will need to download an Ubuntu package from here:

https://www.dropbox.com/downloading?os=lnx

You will need to get the 32-bit Ubuntu version (referred to as "x86 .deb")

e.g.

wget -o nautilus-dropbox_0.6.9_i386.deb https://www.dropbox.com/download?dl=packages/nautilus-dropbox_0.6.9_i386.deb

Then you need to install the software:

sudo dpkg -i nautilus-dropbox_0.6.9_i386.deb

Answer yes to what it asks and then click the button to "Restart Nautilus". Then click "Start Dropbox". You can then sign in and dropbox will start to synchronize your files. There will now be a icon on the top right of your screen that is supposed to look like a box with an open top. This will give you a short cut to

Introduction to Emacs

Initial setup

I missed one emacs package that we need for today. Without a package called htmlize, org-mode output will not have code colored. It is a part of the emacs goodies package. texlive is used to produce PDF documents.

sudo apt-get install emacs-goodies-el
sudo apt-get install texlive texlive-latex-extra

Opening files

I will give an introduction to using emacs for basic files here. This really needs a video of the section to show what I'm doing.

  • opening a directory
  • searching with C-s

Basic org-mode - outlining

The format for org-mode is very similar to Mediawiki. However, the characters used to mark up the text are slightly different. There are large numbers of markup languages, but we will ignore the others right now.

Start by opening a new org mode file. Org-mode starts by default if the file name ends in ".org". "File" -> "Visit New File" and pick type in "example.org".

An alternative approach is to use the keyboard shortcut:

C-x C-f example.org

At the bottom of the window, you will see:

--:--- example.org All L1 (Org)------------

You are staring at a blank page, but there are helpers under the "Org" and "Tbl" (meaning table) menus that just appeared at the top of the Window. Select Org -> New Heading. You will see a "*" appear. Headings are made up of 1 or more "*" characters followed by the text.

* Introduction

Sub-headings have two like this:

** This is a sub heading

You can type paragraphs in any heading or sub-heading.

Lists start with "-". A list looks like this:

- first item
- another item
- yet another

The list will look like this:

  • first item
  • another item
  • yet another

Seeing the results?

But how do we see what the results are??? We have to "publish" or "export" the document. There are many formats, but we will start with HTML.

"Org" -> "Export/Publish"

You will now see lots of options for the output. Start off by trying "export as HTML and open in browser".

Press the letter "b"

You now should see Firefox open up and show the file "example.html".

You can also export to a pdf:

"Org" -> "Export/Publish" -> press "d"

Tables

Tables are built with the vertical "|" character. Entries with all "—" characters create horizontal rulers.

| Column header  | something else           |
|----------------+--------------------------|
| hello          | world                    |
| a second entry | what do you want to say? |

Would look like this:

Column headersomething else
helloworld
a second entrywhat do you want to say?

Examples and source code

You can also create example blocks and source code blocks. Inside of an example, it will not show the normal formatting. Try this:

\#+BEGIN_EXAMPLE 
* This is a heading
\#+END_EXAMPLE

TODO Creating a log - HOMEWORK

DEADLINE: 2011-09-22 Thu

I keep a very detailed log of what I work on in org mode. For Thursday, you will need to turn in a log file

You will turn in a tar file with a directory with three files in it.

The directory will named your username, a dash, and

'''WARNING:''' check back Friday at 5 PM for the complete assignment for homework.

Author: Kurt Schwehr

Date: <2011-09-15 Thu>

HTML generated by org-mode 7.4 in emacs 23