Skip to main content

Settings

Color Mode

Theme Skin

Background

Appearance preferences are saved in this browser only.

Environment

Current Environment Production

Built with JEKYLL_ENV=production. Changes require deployment.

Quick Links

Theme & Build

Jekyll v3.10.0
Last BuildNov 24, 17:25

Page Location

Page Info

Layout default
Collection wargames
Path _wargames/bandit/bandit19.md
URL /wargames/bandit/bandit19/
Date 2026-04-07

Bandit Level 19

Bandit Level 19 — read a file even though .bashrc logs you out, by running a command remotely instead of opening a shell.

Source: This content is aggregated from overthewire (MIT). Visit the original repository for the latest version.

Level Goal

The password for the next level is stored in a file readme in the homedirectory. Unfortunately, someone has modified .bashrc to log you out when you log in with SSH.

Commands you may need to solve this level

ssh, ls, cat

Study guide

Level map: logged in as bandit18, find the password for bandit19.

What this level teaches

That an SSH login is not the only way to run something on a server, and what shell startup files do.

Key ideas

  • .bashrc. A script that bash reads when it starts, used to customise your shell. Whoever controls it controls what happens at login, and attackers abuse that for persistence.
  • Interactive vs command mode. ssh user@host opens an interactive shell, but ssh user@host COMMAND runs one command and returns.
  • Read the argument description in man ssh to see how the command is passed.

How to approach it

  1. Try logging in normally and observe what the modified .bashrc does.
  2. Use the remote-command form of ssh to run ls first, then cat the file the Level Goal mentions.

Why it matters

Automation tools such as Ansible, deployment scripts and Git over SSH all run commands remotely this way.