“Ubuntu dodaj użytkownika do grupy” Kod odpowiedzi

Dodaj użytkownika do grupy

usermod -a -G examplegroup exampleusername
Black Beaver

Dodaj użytkownika do grupy Linux

sudo usermod -aG <groups> <username>
Clever Capybara

Ubuntu dodaj użytkownika do grupy

sudo usermod -aG groupName userName

# restart or just run
newgrp groupName
Tiago F2

Dodaj użytkowników w grupie 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
Joseph the Stainless Rock

Odpowiedzi podobne do “Ubuntu dodaj użytkownika do grupy”

Pytania podobne do “Ubuntu dodaj użytkownika do grupy”

Więcej pokrewnych odpowiedzi na “Ubuntu dodaj użytkownika do grupy” w Shell/Bash

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu