beginner linux script -g and -c

useradd  -g school  -c “John” john

Open in new window



In the code given above,

What I know is it adds group name called "school" and adds a user "john" to school group

not sure what the -c is for

thank you for your help.
bt1942Asked:
Who is Participating?
 
woolmilkporcConnect With a Mentor Commented:
-c defines the "comment", which is generally the user's full name, sometimes called "GECOS".

(Some early Unix systems at Bell Labs used GECOS ["General Electric Comprehensive Operating Supervisor"] machines for print spooling and various other services, so this field was added to carry information on a user's GECOS identity. (Wikipedia))

This string is stored along with the other info in /etc/passwd.

-g does not add a group. It defines John as a member of the group "school".

This group must exist! If it doesn't, use "groupadd" beforehand to create it.

Use "man useradd" and "man groupadd" for detailed info.
0
All Courses

From novice to tech pro — start learning today.