How to add machine accounts?
Burch, Phil
pburch at sccd.ctc.edu
Fri Apr 9 15:01:26 GMT 1999
Here is my add account perl script; hope it helps
#!/usr/bin/perl
$mname = shift();
($mname eq "") && die("ERROR: No workstation name specified!\n");
print "Beginning Account Creation for $mname..\n";
(open(PASSWD, "/etc/passwd")) || die("Failed to open /etc/passwd\n");
while (<PASSWD>){
@entry = split(/:/);
$users{$entry[0]} = 1;
$numbers{$entry[2]} = 1;
}
close PASSWD;
foreach (keys(%users)){
($_ eq $mname) && die("Account already exists!\n");
}
# find first free uid (starting at 10010)
$nuid = 10010;
while(defined($numbers{$nuid})) {
$nuid ++;
}
print "Adding Account $mname:$nuid.\n";
system("useradd -u $nuid -d /dev/null -g machines -s /bin/False -M
$mname\$");
system("smbpasswd -a -m $mname");
print "Account: $mname Created.\n";
#END
(I made a group for machines, you may not want the -g machines in useradd,
you may also want to start at a lower number for user id's I just like to
keep the machine accounts seperate)
Phil Burch
Computing Services
North Seattle Community College
http://nsccux.sccd.ctc.edu
-----Original Message-----
From: Andre Anneck [mailto:andre at anneck.de]
Sent: Thursday, April 08, 1999 2:17 PM
To: Multiple recipients of list
Subject: Re: How to add machine accounts?
Ok... I guess I didnt make myself clear enough.
I have the trailing $ at the machine-accounts name wich is the
username in the /etc/passwd...
but when I run smbpasswd it still complains about the account
would not be existend... ??!!!?!?...
Here is what I do:
1. Edit /etc/passwd, add the following line:
mypdc$:dummy:1001:1001:test:/dev/nul:/usr/sbin
2. Save /etc/passwd
3. Do at the prompt:
/usr/local/samba/bin/smbpasswd -a -m mypdc
And I get this response:
User "mypdc$" was not found in system password file.
What am I missing????
>
> The users you add in /etc/passwd must be machine accounts. That is, if
> your machine is called dilbert, the account in /etc/passwd must be
> "dilbert$".
>
> Greg
>
> --------------------------------------------------------------------- Greg
> Dickie Just A Guy* *from discreet (the logic is gone) Montreal (514)
> 954-7171 greg at discreet.com
>
>
> On Thu, 8 Apr 1999, Andre Anneck wrote:
>
> > Hi there,
> >
> > I am running FreeBSD 3.1, Samba 2.0.3,
> >
> > When I try to add a machine account it always gives me
> > "bla <machine_name$> does not exist in system password file"
> > or something like this, sorry have my box not handy right now.
> >
> > I edited /etc/passwd
> > And inserted some testusers, referring to those people who already did
> > it...
> >
> > I try to add the account with
> > /smbpasswd -a -m <machine_name>
> >
> > I have read several mails in the archive that claim that it would be as
> > easy as that. Addin a line in /etc/passwd, then using smbpasswd with
> > options a, m.
> >
> > I think I missed something so obvious I cant see it... please open my
> > eyes... I would like to have the Samba Box to be my PDC... *sniff*.
> >
> >
> > The UORMSS - Source Net
> > http://www.anneck.de/rmss
> > -------------------------------------
> > ICQ# 1339921 | Home: http://anneck.de
> >
>
The UORMSS - Source Net
http://www.anneck.de/rmss
-------------------------------------
ICQ# 1339921 | Home: http://anneck.de
More information about the samba-ntdom
mailing list