LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 10-28-2009, 09:25 AM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Debian
Posts: 2,896

Rep: Reputation: 73
Question Default Group For New Users


I have a CentOS 5.3 server and noticed something strange today. I have a default group that I add new users to. I know the group exist and in /etc/group the GID is 500.
So rather than having to use the '-g 500' switch everytime I run the 'useradd' command, I decided to edit my /etc/default/useradd file to read the following:

Code:
[root@mail ~]# cat /etc/default/useradd 
# useradd defaults file
GROUP=500
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/false
SKEL=/etc/skel
CREATE_MAIL_SPOOL=no
Now I rebooted the server since making that change even though I don't think that matters and now when I created a new user. I noticed the system also created a username / groupname rather than just adding the new user to the existing group of '500'.

Code:
[root@mail ~]# useradd -c "Test User" test
[root@mail ~]# id test
uid=1592(test) gid=1592(test) groups=1592(test)
[root@mail ~]# finger test
Login: test           			Name: Test User
Directory: /home/test               	Shell: /bin/false
Never logged in.
No mail.
No Plan.
Now it created a group called 'test' so it completey ignored the 'GROUP' parameter from the file above but it did set them to /bin/false and did not create a mail spool file for the user. If I mod those in the file above, the changes are reflected. I don't understand what is wrong. Is this a bug?

Code:
[root@mail ~]# userdel -r test
[root@mail ~]# vim /etc/default/useradd 
[root@mail ~]# useradd -c "Test User" test
[root@mail ~]# id test
uid=1592(test) gid=1592(test) groups=1592(test)
[root@mail ~]# finger test
Login: test           			Name: Test User
Directory: /home/test               	Shell: /bin/bash
Never logged in.
No mail.
No Plan.
[root@mail ~]# ls -l /var/spool/mail/test 
-rw-rw---- 1 test mail 0 Oct 28 10:23 /var/spool/mail/test
 
Old 10-28-2009, 10:03 AM   #2
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Debian
Posts: 2,896

Original Poster
Rep: Reputation: 73
Found my own answer in the man page...go figure.

Quote:
-n A group having the same name as the user being added to the system will be created by default. This option will turn off this Red Hat Linux specific behavior.
When this option is used, users by default will be placed in whatever group is specified in /etc/default/useradd. If no default group is defined, group 1 will be
used.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Secondary group users need to change the file permissions of primary group files? sunnybmv Linux - Newbie 3 12-10-2009 04:57 PM
Script to add a secondary group to all users except system default users Tekken Linux - Server 5 06-29-2009 04:02 PM
Group quota not limiting for users not identical to the group? jalexxi Linux - Server 1 03-10-2009 12:44 AM
I want a group to nice and renice the processes of other users of the same group tim_c Linux - Newbie 1 01-05-2007 05:39 AM
"adduser" not adding users to default group "users" PunkPT Slackware 2 09-23-2004 11:50 AM


All times are GMT -5. The time now is 02:49 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration