The following script helps IT Admins to create a local user with sudo/root privileges.
Copy and save the contents below to a UTF-8 editor like notepad++ OR Sublime Text in Windows or gedit in Ubuntu.
If you are using notepad++ then use the bottom right panel to change the type to Unix (LF).

Or click here to download the file.
#!/bin/bash # Check if the script is run as root if [ "$(id -u)" -ne 0 ]; then echo "This script must be run as root" exit 1 fi # Set username and password username="XXXX" password="XXXX" # Create user useradd -m "$username" # Set password echo "$username:$password" | chpasswd # Add user to sudo group usermod -aG sudo "$username" echo "Sudo user $username has been created successfully."Before uploading the script to the dashboard, replace the placeholder values with the credentials you want to use:
username (xxxx): Enter the desired username.
password (xxxx): Enter the desired password.
Ensure that both placeholders are updated before deploying the script.
Follow our guide to upload & publish the script using Scalefusion Dashboard.
Note:
Some of the scripts and their contents are sourced from internet and yes, our new friend ChatGPT.
Please validate the scripts on a test machine before deploying them on all your managed devices.
Scalefusion has tested these scripts, however Scalefusion will not be responsible for any loss of data or system malfunction that may arise due to the usage of these scripts.