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