General documentation / cheat sheets for various languages and services

sudo opinions

sudo EDITOR=vim visudo

Then:

  1. Delete any Defaults requiretty line to avoid “you must have a tty to run sudo” errors
  2. Let “sudo” group members sudo without password:
    -%sudo ALL=(ALL:ALL) ALL
    +%sudo ALL=(ALL:ALL) NOPASSWD: ALL
    
  3. (On distros with systemd:) Add Defaults env_keep += "SYSTEMD_PAGER" to /etc/sudoers

Adding a new user on linux

On the remote machine:

sudo useradd -m -U -G wheel chbrown

And then maybe set the password:

sudo passwd chbrown

Return to the local machine. Copy default local public key to the remote machine:

ssh-copy-id chbrown@remote

Or if you don’t have ssh-copy-id:

  1. On remote:
    mkdir -pm 700 ~/.ssh
    touch ~/.ssh/authorized_keys
    chmod 644 ~/.ssh/authorized_keys
    
  2. On local:
    cat ~/.ssh/id_rsa.pub | ssh remote 'cat >> ~/.ssh/authorized_keys'