The Goal

The password for Level 19 is stored in a file called readme in the home directory. The catch is that someone has modified .bashrc to log you out the moment you log in via SSH.

The Approach

If going to the file is not possible, the file can come to you. scp does not start an interactive shell, so the .bashrc logout does not trigger. The readme file lives in the home directory, so the remote path is just the filename:

$ scp scp://bandit18@bandit.labs.overthewire.org:2220/readme ~/otw
readme 100% 33 0.2KB/s 00:00
$ cat ~/otw/readme
password

Commands Covered

  • scp scp://user@host:port/file /local/dest, copy a file from a remote server without opening an interactive shell