Why Is This Port Open? Answering It in One Command with witr

Replace manual netstat workflows with witr’s single-command answers

Introduction: the late-night “what was this port again?” problem When you run servers, you repeatedly end up in the situation where you see an alert in the middle of the night, SSH into the machine, and think “what is listening on this port again?” Until now I combined netstat / ss / lsof / nmap / systemctl / docker ps and worked out the identity and the origin of the process by hand. Recently I started using a CLI tool called witr (Why is this running), and because it explains in a single command even why a process exists, my investigation flow has changed considerably. [Read More]

Why sudo Loses Your PATH on Linux and How to Keep It

How to keep your PATH when using sudo on Linux

When you use the sudo command on Linux, the PATH you configured as a normal user is not applied and you can end up with “command not found”. This happens especially often when you try to run a command inside Linuxbrew (Homebrew) with sudo and the command cannot be found. This article explains how to carry your PATH environment variable over into sudo. Why PATH changes under sudo For security reasons, sudo resets environment variables by default. [Read More]

No Matching Host Key Type Found After Upgrading to OpenSSH 8.8

OpenSSH 8.8 disables RSA signatures

I updated openssh with Homebrew on my Mac, and after the version went up I could no longer connect, with the error below. Copy ERROR: Unable to negotiate with 192.168.1.10 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss The error did not appear for every destination; the ones I could no longer reach were those running relatively old operating systems. SSH that can connect Copy $ ssh -V OpenSSH_8.4p1 Debian-5, OpenSSL 1.1.1k 25 Mar 2021 SSH that cannot connect Copy $ ssh -V OpenSSH_8.9p1, OpenSSL 1.1.1n 15 Mar 2022 Looking into it, the cause is that RSA keys with SHA-1 have been disabled since OpenSSH8.8 [Read More]

Creating Password-Protected ZIP Files on Linux and macOS

Creating a password-protected zip, and adding a password to an existing zip file

The other day, while self-hosting Bitwarden with Docker , I realised that leaving the data exported from LastPass and 1Password lying around as it is would be dangerous. Deleting it once it is no longer needed is probably the best answer, but I wanted to keep it as a backup, so I decided to save it as a password-protected zip. Creating a password-protected zip When you want to create a password-protected zip from a file Copy $ zip -e sample.zip sample.txt Enter password:<enter the password> Verify password:<enter the password> adding: test (stored 0%) When you want to create a password-protected zip from a directory When a directory is involved you need to be careful, because if you forget the -r option you end up with an empty zip file [Read More]