From 718c25bf3cc8806f75ffe6b26a4617fc1b6d0c01 Mon Sep 17 00:00:00 2001 From: sthope Date: Sun, 17 Apr 2022 16:21:39 +0200 Subject: [PATCH] Add 'custom-cmds-in-ubuntu/bin_examples/autouser' --- custom-cmds-in-ubuntu/bin_examples/autouser | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 custom-cmds-in-ubuntu/bin_examples/autouser diff --git a/custom-cmds-in-ubuntu/bin_examples/autouser b/custom-cmds-in-ubuntu/bin_examples/autouser new file mode 100644 index 0000000..23d0136 --- /dev/null +++ b/custom-cmds-in-ubuntu/bin_examples/autouser @@ -0,0 +1,22 @@ +#!/bin/bash +# ___ _ _ _ __ +# / __|| |_ | |_ ___ | '_ \ ___ +# \__ \| _|| \ / _ \| .__// -_) +# |___/ \__||_||_|\___/|_| \___| + +## nano ~/.bashrc +## and add this to the end of the file: export PATH=$PATH:~/bin +## sudo chmod +x ~/bin/*;su -l $USER + +### USAGE: + +U=$1 +P=$2 +R=$4 + +if [ "$3" = "sudo" ] +then + echo $4 | sudo -S adduser $U --gecos "69,69,69,69" --disabled-password;echo "$U:$P" | sudo chpasswd;usermod -aG sudo $U +else + adduser $U --gecos "69,69,69,69" --disabled-password;echo "$U:$P" | chpasswd;usermod -aG sudo $U +fi \ No newline at end of file