Skip to content

Powered by Grav

User management

User management

How to rule them all

User commands

Create users

Create a sudo user named mountdoom and set their password

BASH
sudo useradd -m -G sudo -s /bin/bash mountdoom
sudo passwd mountdoom

Create a system user named morgul unable to login and without /home directory

BASH
sudo useradd -r -s /usr/sbin/nologin morgul

Delete users

Delete a regular user bombadil, along with their group and home directory

BASH
sudo userdel -r bombadil && sudo groupdel bombadil

SSH key authentification

Connect passwordless from a client to remote.ip.address in a terminal using key pairs as authentification

Creating and storing keys

On the client, create a pair of public/private named keys of high KDF rounds

BASH
ssh-keygen -t ed25519 -a 100 -f ~/.ssh/mordor

Copy this key to the remote device; mountdoom user must already exist on the remote

BASH
ssh-copy-id -i ~/.ssh/mordor.pub mountdoom@remote.ip.address

Connect to the remote

BASH
ssh -i ~/.ssh/mordor mountdoom@remote.ip.address

Creating a connection alias

Connect to remote.ip.address passwordless by calling its hostname mordor.
On the client, open SSH config

BASH
nano ~/.ssh/config

And paste

TEXT
Host mordor
  HostName remote.ip.address
  User mountdoom
  IdentityFile ~/.ssh/mordor

Connect to the remote using

BASH
ssh mordor

Connection alias to a subnet

Connect passwordless to a machine IP remote.ip.address located on a subnet by calling its hostname gondor, through its gateway IP gateway.ip.address (hostname mordor).
On the client, open SSH config

BASH
nano ~/.ssh/config

And paste

TEXT
Host mordor
  HostName gateway.ip.address
  User mountdoom
  IdentityFile ~/.ssh/mordor

Host gondor
  HostName remote.subnet.ip.address
  User strider
  ProxyJump mordor

Connect to the remote using

BASH
ssh mordor

Remove a specific entry from known_host

Delete remote IP 192.168.0.80

BASH
ssh-keygen -f '~/.ssh/known_hosts' -R '192.168.0.80'

© 2026 howto.cogip.be. All rights reserved.