Configuring Your Device

Linux

Red Hen works exclusively in the Linux operating system, although Mac OS 10 works, too, since it has a mock Unix shell that can be expanded via Macports, with the result that, for Red Hen's purposes, a Mac does everything Red Hen uses Linux to do, although there are inevitably some differences. Red Hen principals routinely work on Mac laptops, connecting to various Red Hen Linux devices (ranging from monster servers to tiny credit-card computers like Raspberry Pis), and they move seamlessly across them.

Linux on Mac: it requires a sequence of fairly straightforward steps, but it is possible to partition the internal hard disk on a MacBook Pro so that the device can be booted into either Mac OSX or Linux. This is called "dual boot." Red Hen typically works with Debian on Mac. Here are tutorials:

Terminal

To connect from your device to a Red Hen device, you will need some Terminal application on your device. If your device is a Linux device (e.g. a Raspberry Pi), then the command line is your terminal. If your device is a Mac, open the Terminal app and work from there. if your device is a Windows device, you might try PuTTY as your terminal.

RSA keys

Security on the Red Hen network is very tight. Red Hen prefers to avoid password authentication, except occasionally for very temporary accounts during classroom tutorials, on very restricted devices not otherwise connected to the Red Hen network. Red Hen prefers authentication by RSA key pairs.

At the command line prompt in Terminal (the prompt is often a $), type

ssh-keygen -t rsa

and press Enter on all the questions you are then asked (unless you want a passphrase in addition, which is normally not needed).

This will create a subdirectory in the home directory of your user account on your computer named .ssh (the period makes the folder invisible, but you can see it in Terminal by typing ls -a at the prompt when you are in your home directory). It will put two keys into that folder, named id_rsa and id_rsa.pub. You need to mail your director in Red Hen your id_rsa.pub

Once Red Hen creates an account for you on a device, and puts your id_rsa.pub key in ~/.ssh/authorized_keys in your home directory on that device, you can log in without password.

.bashrc and .profile

For any user on any Linux or Mac device you intend to use to interact with Red Hen, it is recommend that you create in your home directory a .bashrc file something like:

# Local .bashrc file for interactive bash(1) shells.
if [ -n "$PS1" ]; then PS1='\h:\w \u\$ '; fi
# Make bash check its window size after a process completes
shopt -s checkwinsize
# If running interactively
if [ "$PS1" ]; then  
    alias screen='screen -U'  # UTF8 screen
    # set a fancy prompt
    PS1='\u@\h:\w\$ '
    # environment variables
    export EDITOR=/usr/bin/vim
    export XGRID_CONTROLLER_HOSTNAME=x
    function calc () {
      awk "BEGIN { print $* ; }"
    }
fi

Red Hen also recommends that you create in your home directory a .profile account with the content

source .bashrc

If you are using Macports or Python, they will add pathways to this .profile file.

Installing and Configuring Screen

https://raspi.tv/2012/using-screen-with-raspberry-pi-to-avoid-leaving-ssh-sessions-open

Install with

sudo apt-get install screen

Red Hen also recommends creating a .screenrc file in your home directory with this content:

# Allow scrolling in buffer

defscrollback 5000

termcapinfo xterm* ti@:te@

# Quiet please

startup_message off

# Status bar

hardstatus on

hardstatus alwayslastline

hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "

Setting Locale to accept UTF8 character encoding

sudo vi /etc/default/locale

Add:

LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8
LANGUAGE=en_US.UTF-8

Then reboot