Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

ubuntu add user to group

sudo usermod -a -G group username
Comment

add user to group linux

sudo usermod -aG <groups> <username>
Comment

ubuntu add user to group

sudo usermod -aG groupName userName

# restart or just run
newgrp groupName
Comment

group of user ubuntu

groups <username>
Comment

linux add user to group

sudo groupadd $GROUP 
sudo usermod -aG $GROUP $USER
Comment

add users in group ubuntu

#!/bin/bash



while [ x$username = "x" ]; do



read -p "Please enter the username you wish to create : " username



if id -u $username >/dev/null 2>&1; then



echo "User already exists"



username=""



fi



done



while [ x$group = "x" ]; do



read -p "Please enter the primary group. If group not exist, it will be created : " group



if id -g $group >/dev/null 2>&1; then



echo "Group exist"



else



groupadd $group



fi



done



read -p "Please enter bash [/bin/bash] : " bash



if [ x"$bash" = "x" ]; then



bash="/bin/bash"



fi



read -p "Please enter homedir [/home/$username] : " homedir



if [ x"$homedir" = "x" ]; then



homedir="/home/$username"



fi



read -p "Please confirm [y/n]" confirm



if [ "$confirm" = "y" ]; then



useradd -g $group -s $bash -d $homedir -m $username



fi
Comment

PREVIOUS NEXT
Code Example
Shell :: check codedeploy agent status 
Shell :: check git version linux 
Shell :: rename a commit pushed 
Shell :: git set upstream 
Shell :: how to uninstall gitlab in ubuntu 
Shell :: windows npm install permission denied 
Shell :: change last commit message 
Shell :: git sync local branch with remote 
Shell :: git reset file to master 
Shell :: install webmin ubuntu 
Shell :: export path linux 
Shell :: assign default value in shell script 
Shell :: portainer instal 
Shell :: git save username and password 
Shell :: how to add flutter packages from git 
Shell :: how to check cpu temperature ubuntu 
Shell :: clockwork 
Shell :: deny directory listing htaccess 
Shell :: certbot renew single domain 
Shell :: completely remove ros melodic 
Shell :: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)! 
Shell :: plate form ignore in laravel composer install 
Shell :: what version of powershell do i have 
Shell :: install vscode ubuntu 20.04 
Shell :: ubuntu adb 
Shell :: device manager cmd command 
Shell :: install polybar ubuntu 20.04 
Shell :: install vercel npm 
Shell :: -bash: : Permission denied 
Shell :: yarn download windows 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =