is this useradd statements correct?
i m still kind of new to linux, i have done man useradd and man groupadd, stil unsure, pls check this for me:
objective: - add group a, b, - add user u1 into both group, and root into group b is the following stmts correct? groupadd a groupadd b useradd -g a u1 useradd -g b -M u1 useradd -g b -M root thank you. |
For the secondary group use -G. The -g sets the primary group, so the fourth command resets the primary group of u1 from a to b (i.e. u1 belongs to group b, not a and b). You could combine lines 3 and 4 into one line:
Code:
useradd -g a -G b -M u1 Code:
useradd -g b -M root Code:
usermod -g b root |
the groupadd commands are correct, but don't use useradd to modify existing accounts. instead, use usermod. so the command would be, for example,
Code:
usermod -G a,b u1 |
All times are GMT -5. The time now is 03:20 PM. |