If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > useradd script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-29-02, 11:03
plgii plgii is offline
Registered User
 
Join Date: Oct 2002
Posts: 2
Unhappy 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?
Reply With Quote
  #2 (permalink)  
Old 11-06-02, 11:05
WingMan WingMan is offline
Registered User
 
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!)
Reply With Quote
  #3 (permalink)  
Old 11-06-02, 11:54
plgii plgii is offline
Registered User
 
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!!!
Reply With Quote
  #4 (permalink)  
Old 01-19-03, 04:19
sumofen sumofen is offline
Registered User
 
Join Date: Jan 2003
Location: Bangladesh
Posts: 1
Thumbs up Re: useradd script

Quote:
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?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On