You are here: start » handbook » runbooks » debian_tweaks

Debian Quick Tweaks

A list of quick tweaks in Debian (and Ubuntu) that I frequently have to Google

Set Timezone

Interactive command:

dpkg-reconfigure tzdata

Manual commands:

Check current timezone, time & date:

timedatectl

Set new timezone:

sudo timedatectl set-timezone America/New_York

Create group

sudo groupadd [groupname]

Enable passwordless sudo for a group

sudo visudo

Add the following to the file (optionally change the group name) and save the file:

# Allow members of group wheel to execute any command without a password
%wheel[or other group] ALL=(ALL) NOPASSWD: ALL

Add user

adduser [username]

Recommend generating a password for the user and saving it in 1Password.

Manually add SSH key for a user

Switch to the user:

su - [username]

Make .ssh directory (if it does not already exist):

mkdir -p ~/.ssh

Add SSH pubkey to authorized_keys file (replace [publickey] with the contents of the public key file, starts with ssh-rsa AAAA…):

echo [publickey] >> ~/.ssh/authorized_keys

Fix .ssh directory permissions:

chmod -R go= ~/.ssh
chown -R [username]:[username] ~/.ssh

Add user to a group

usermod -aG [group] [username]