Skip to content

Linux

First obtained value will be used:

Config:

Host foo
User foot
Host barry
IdentityFile ~/.ssh/another
Host bar*
User bart
Host barman
User barman
HostName barman.example.com
Host foo bar*
HostName example.com
Host foo
IdentityFile ~/.ssh/foo
Host bar*
IdentityFile ~/.ssh/%h

Effect (OpenSSH 9.x, checked with 9.6p1):

run result
ssh foo ssh foot@example.com -i ~/.ssh/foo
ssh bar ssh bart@example.com -i ~/.ssh/example.com
ssh barman ssh bart@barman.example.com -i ~/.ssh/barman.example.com
ssh barry ssh bart@example.com -i ~/.ssh/another -i ~/.ssh/example.com
ssh barqa ssh bart@example.com -i ~/.ssh/example.com

IdentityFile is an exception: all matching values are added and tried in order. %h is the host name after HostName is applied, not the alias typed on the command line (that is %n).

Source: https://man.openbsd.org/ssh_config

Prevent “Too many authentication failures” error

Section titled “Prevent “Too many authentication failures” error”

Use:

Host *
IdentitiesOnly yes

Source: How to Fix “SSH Too Many Authentication Failures” Error

Check what applies to a host with ssh -G <host>. With IdentitiesOnly yes, set IdentityFile per host, otherwise only the default keys are offered.

~/.bash_profile for Debian and Ubuntu, whose stock ~/.profile already loads ~/.bashrc:

Terminal window
# PATH first: .profile below sources .bashrc, which may need these tools
if [[ -d "$HOME/.npm-global/bin" ]]; then
PATH="$HOME/.npm-global/bin:$PATH"
fi
export PATH
# the leading ":" keeps PHP's default scan directory
export PHP_INI_SCAN_DIR=":$HOME/.config/php"
if [[ -f "$HOME/.profile" ]]; then
source "$HOME/.profile"
fi

See Bash startup files. Check the PHP result with php --ini.

Terminal window
mkdir -p ~/.npm-global
npm config set prefix "$HOME/.npm-global"

Add ~/.npm-global/bin to PATH as in the profile above. The npx cache is in ~/.npm/_npx.

This removes a safety barrier: any process running as your user can become root.

Terminal window
sudo visudo -f /etc/sudoers.d/90-nopasswd

Add one line with your user name:

<username> ALL=(ALL:ALL) NOPASSWD: ALL

Files in /etc/sudoers.d whose name contains a dot are ignored. Verify with:

Terminal window
sudo -k && sudo -n true && echo OK

To undo: sudo rm /etc/sudoers.d/90-nopasswd.

Terminal window
# which installed package owns a file
dpkg -S /usr/bin/ldd
# which package provides a file that is not installed yet
sudo apt install apt-file && sudo apt-file update
apt-file search libfoo.so.1

For error while loading shared libraries, list what is missing:

Terminal window
ldd <executable> | grep 'not found'

ldd may execute the program; for an untrusted binary use readelf -d <file> | grep NEEDED. Find the package with apt-file search (above). For a 32-bit binary (file <executable> shows ELF 32-bit) run sudo dpkg --add-architecture i386 && sudo apt update, then install the :i386 package.

If the library is installed in a non-standard directory:

Terminal window
ldconfig -p | grep libfoo
sudo ldconfig # after adding the directory to /etc/ld.so.conf.d/
Terminal window
sha256sum file1 file2 > sha256sums.txt
sha256sum --ignore-missing --check sha256sums.txt
md5sum --ignore-missing --check md5sums.txt

With --ignore-missing, the command still fails if none of the listed files exist. MD5 only detects accidental corruption.

Opens the UEFI settings. Works only on a system booted in UEFI mode with firmware that supports it:

Terminal window
sudo systemctl reboot --firmware-setup

In /etc/default/grub:

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

Then, on Debian, Ubuntu and Mint:

Terminal window
sudo update-grub
sudo grub-editenv list

GRUB cannot save the choice if /boot is on LVM, RAID, ZFS or LUKS. See Environment block.

Terminal window
signal-desktop --start-in-tray # start hidden in the tray
signal-desktop --use-tray-icon # show the window; closing it minimizes to the tray

Both flags override the tray setting saved in the application.

X11 only. Locks input after 5 minutes and warns 30 seconds earlier:

Terminal window
sudo apt install xtrlock xautolock libnotify-bin
xautolock -notify 30 -notifier "notify-send -t 25000 LOCK" -time 5 -locker xtrlock &

xtrlock does not hide the screen, so it is not a privacy lock.