Changing Shifts — Terminal

Take over the micro-hydro plant's server from Mas Krisna: ssh, signals, tmux, curl, npm, dotfiles. 16 levels, right in the browser.

What you learn in this game

SSH logs in to another machine without a password using a key pair: one private, one public. The server keeps the public one; the laptop holds the private one and uses it to prove it owns the pair. In Ganti Jaga every command is run by real tools (OpenSSH, bash, tmux, curl, npm), and the terminal in the book copies what they print.

Every file on Linux has permissions for three parties: the owner, the group, and everyone else. ls -l writes them like rw-r--r--, and chmod changes them with octal digits. ssh checks a private key's permissions before it uses it.

The first time you log in to a server, ssh saves that server's key in ~/.ssh/known_hosts. After that, the key the server sends must be the same. If it differs, ssh cannot tell whether the server was replaced or someone is pretending to be it, so it stops.

~/.ssh/config gives a server a short name with its settings: address, user, port, key. One name can match several Host blocks, and ssh combines them by its own rule.

A service that listens only on 127.0.0.1 cannot be reached from another machine. That is on purpose for a panel that sets the turbine's valve. ssh -L makes a tunnel: a port on the laptop is forwarded over the ssh connection to an address as the server sees it.

Every process has a number (PID) and a parent (PPID). kill sends a signal: some ask politely to stop, some force it, some only freeze the process. A script can catch a signal with trap to tidy its work first.