Last active
January 6, 2024 11:56
-
-
Save pacharanero/1468b8ce95d410da57f84e751d02e5e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
set -e | |
# set a default new username | |
# if you set NEW_USERNAME="other_username" before running the script, it will use your value | |
NEW_USERNAME="${NEW_USERNAME:-marcus}" | |
# add update script | |
echo """doupdates () { | |
export DEBIAN_FRONTEND=noninteractive | |
sudo apt-get update | |
sudo apt-get -y dist-upgrade | |
sudo apt-get -y autoremove | |
sudo apt-get -y autoclean | |
}""" | sudo tee -a /etc/profile | |
source /etc/profile | |
# set unattended upgrades | |
dpkg-reconfigure -plow unattended-upgrades | |
# create new user | |
adduser $NEW_USERNAME | |
# add new user to sudo group | |
usermod -aG sudo $NEW_USERNAME | |
# add to sudoers file | |
echo "$NEW_USERNAME ALL=(ALL) NOPASSWD: ALL" | (EDITOR="tee -a" visudo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment