#!/bin/bash # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # create new system user / frode klevstul / oct 2025 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if [ "$EUID" -ne 0 ] then echo "error: run as 'root'" exit fi this_file_name=`basename "$0"` if [ $# -ne 1 ]; then echo usage: ${this_file_name} [USERNAME] exit 1 fi username=$1 # --- # create a new non-root user # --- adduser --disabled-password --gecos "" ${username} mkdir /home/${username}/.ssh cp /root/.ssh/authorized_keys /home/${username}/.ssh/ chown ${username}:${username} /home/${username}/.ssh/ chown ${username}:${username} /home/${username}/.ssh/authorized_keys