Results 1 to 4 of 4

Thread: useradd script

  1. #1
    Join Date
    Oct 2002
    Posts
    2

    Unhappy Unanswered: useradd script

    when trying to add user in Suse linux with useradd, I use the -g users to add new user to primary group but when I vi the group file the users name has not been added to users group. It will add to other groups with the -G groupname.
    any thoughts?

  2. #2
    Join Date
    Aug 2002
    Location
    UK
    Posts
    87
    when you add the user the groupID in /etc/passwd should be the default groupID which is the ID assigned to Users in the /etc/group file.

    Thus i'm not sure that you have to specify the user again within that group which is why the user name does not appear in the /etc/group file.
    But the user does appear when you assign another group for the user as they would then be in the Users group and the new group.

    clear as mud ??

    (of course i could be completely wrong!)

  3. #3
    Join Date
    Oct 2002
    Posts
    2

    Talking

    when you create the user it does place name in the /etc/group file, but then if your script also uses the -G option to add to other groups, it copies the /etc/group file to /etc/group- and then writes the new group entries. But it firsts copies the /etc/group- file, which is a template with no entries in the users group, back to /etc/group so the new user is now NOT listed in the copied /etc/group file and then adds the additional group entries. Confusing???
    What needs done in the adduser script is to copy the /etc/group file AFTER user has been created and they are listed in the users group to /etc/group- so that when you add addtional group entries with the -G option, it does it thing of copying the template /etc/group- to /etc/group, but this time user is listed in the users section as well as any addtional group because you trick the system when it does its copy back. It thinks it is copying the blank template /etc/group- file to /etc/group, but etc/group- at that point is really a copy of the etc/group file.... whew!!!

  4. #4
    Join Date
    Jan 2003
    Location
    Bangladesh
    Posts
    1

    Thumbs up Re: useradd script

    Originally posted by plgii
    when trying to add user in Suse linux with useradd, I use the -g users to add new user to primary group but when I vi the group file the users name has not been added to users group. It will add to other groups with the -G groupname.
    any thoughts?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •