Created
December 10, 2019 07:42
-
-
Save somejavadev/b4e9e40c2d18edf850cfa26055151b2a to your computer and use it in GitHub Desktop.
Creates a new user on raspbian cloning the pi user groups for this new user.
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 | |
# Creates a new user on raspbian | |
# cloning the pi user groups for | |
# this new user. | |
new_user=$1 | |
adduser "$new_user" | |
new_groups=`groups pi` | |
new_groups=${new_groups:8} | |
for g in $new_groups; do | |
echo "Adding to $g" | |
sudo usermod -a -G $g $new_user | |
done | |
echo "All groups for user: $new_user" | |
echo `groups $new_user` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Basic Usage: