Nicholas Dodds

CS131 server setup

CS131 server setup

Set up a test server for CS131: password SSH, zsh defaults for new accounts, the course image in a shared Podman store, student accounts and memory limits.

Incomplete record: three course-specific settings are missing and marked where they're needed. Not rerun; see Testing and references.

What you'll build

A server where students log in over SSH with a password, get zsh and oh-my-zsh by default, and start the CS131 course image from a shared Podman store, with a memory limit for each user.

Before you start

Test server only

These commands use sudo throughout and change SSH, storage and account settings. Don't run them on your own machine or any server that matters unless you know what each one does.

1. Allow password login over SSH

  1. Update the system's packages, answering Y or pressing Enter when asked:

    sudo apt update && sudo apt upgrade
  2. Install SSH, start it at boot and allow it through the firewall:

    sudo apt install openssh-server && \
    sudo systemctl enable ssh && \
    sudo ufw allow ssh
  3. Install the micro text editor:

    sudo snap install micro --classic
  4. Open the SSH configuration:

    sudo micro /etc/ssh/sshd_config

    If the course requires password login, set PasswordAuthentication yes. Also check the files in /etc/ssh/sshd_config.d/: Ubuntu reads them first, and an earlier value overrides the main file. See Ubuntu's OpenSSH guide.

  5. Check the configuration and restart SSH. Keep your current connection open until a second login works:

    sudo sshd -t && sudo systemctl restart ssh.service

A second SSH login with a password works.

2. Install zsh and oh-my-zsh

  1. Install zsh:

    sudo apt install zsh -y
  2. Install curl and git:

    sudo apt install git curl
  3. Install oh-my-zsh, following its prompts and entering your password when asked:

    sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

3. Install Podman and pull the course image

  1. Install Podman:

    sudo apt install podman
  2. Test it with the Hello World image:

    podman run hello-world
  3. Make a shared image store, pull the course image into it, and list it:

    sudo mkdir /var/lib/shared-images && \
    sudo podman --root /var/lib/shared-images/ pull docker.io/harveymudd/cs131 && \
    sudo podman --root /var/lib/shared-images image ls

4. Configure shared image storage

Missing setting

This record leaves out the additionalimagestores setting that storage.conf needs. Get the reviewed setting for this server before continuing; changing permissions alone doesn't configure shared storage.

  1. Create the system-wide storage configuration and add the setting:

    sudo micro /etc/containers/storage.conf
  2. Let every user read the images:

    sudo chmod -R a+rX /var/lib/shared-images/

5. Set defaults for new accounts

Missing alias

New accounts copy .zshrc from /etc/skel, so the cs131env alias has to be in it before you copy it. This record leaves out the alias body; get the course-approved shell configuration first.

  1. Copy oh-my-zsh into /etc/skel, edit your .zshrc to add the alias, and copy it there too:

    sudo cp -r ~/.oh-my-zsh /etc/skel/.oh-my-zsh && \
    sudo micro ~/.zshrc && \
    sudo cp ~/.zshrc /etc/skel/.zshrc
  2. Load the new settings in your shell:

    source ~/.zshrc

6. Create a student account

  1. Create user001 and give it a strong, unique password:

    sudo useradd -m -c "Test User 001" -s /bin/zsh user001 && \
    sudo passwd user001
  2. Make sure the account can read the shared images:

    sudo chmod -R a+rX /var/lib/shared-images/

7. Log in as a student

  1. Connect as user001 and enter the password from step 6:

    ssh user001@cs131.cs.hmc.edu
  2. Start the course environment with the alias from step 5:

    cs131env

8. Limit each user's memory

Missing limits

This record leaves out the [Slice] resource settings and the approved limit for 50-memory.conf. Get both from the course operator before continuing.

  1. Become root and create the memory configuration for user sessions:

    su && \
    cd /etc/systemd/system && \
    mkdir -p /etc/systemd/system/user-.slice.d && \
    micro /etc/systemd/system/user-.slice.d/50-memory.conf
  2. After adding the settings, reload systemd:

    systemctl daemon-reload

9. Test the memory limits

Watch memory use in htop while running memory-heavy commands.

Testing and references

A recorded procedure with three settings missing, listed in Before you start. Selected commands were checked against documentation in September 2026; the setup wasn't rerun.