New Samba Install / Replicating UNIX Passwords Over to smbpas
swd File
MCCALL,DON (HP-USA,ex1)
don_mccall at hp.com
Thu Mar 29 20:33:15 GMT 2001
Hi James,
Try this:
#touch /tmp/smbpasswd.in
#addtosmbpass `cut -f1 -d: /etc/passwd` </tmp/smbpasswd.in
>/usr/local/samba/private/smbpasswd
^^^^^^all one line^^^^^^
This should pass a list of all the usernames in your /etc/passwd file to
addtosmbpass, and create an smbpasswd file of the proper format in
/usr/local/samba/private/smbpasswd.
Another way to do it, if you pulled the SOURCE as well, or if your
distribution includes
the 'scripts' directory, is:
/opt/samba_src/samba/source/scripts/mksmbpasswd.sh
(this will be a different path on your installation, I am sure - the above
is from the
HP-UX 11.0 installation)
This will take all the entries in your /etc/passwd file and create
appropriate entries in your smbpasswd file (which you should locate in the
/usr/local/samba/private subdirectory, or whereever your specific
installation expects it).
The syntax is as follows:
cat /etc/passwd|mksmbpasswd.sh >/var/opt/samba/private/smbpasswd
You will probably want to go in and remove the entries for root, ftp, etc
afterwards. And you will still have to use smbpasswd to set your user's pc
passwords. But it's quick...
**************************
but since there is no way to generate an NTLM encrypted password directly
from the Unix encrypted password in the /etc/passwd file, you NEED a way to
allow your unix users to change their own smb passwords. The smbpasswd
command
when run by a NON-root user, requires that they know the current password in
order to change it.
Below I have documented a method whereby you can set ALL passwords in the
smbpasswd file to an 'initial' password that you can give your unix users to
allow
them to change their own password from unix using the smbpasswd command:
1. Create the smbpasswd file using one of the methods explained above.
2. use the smbpasswd command, as root, to create an initial password for
one of the users now in the smbpasswd file:
#/opt/samba/bin/smbpasswd username
New SMB password: fishlips (not actually echoed, just here for
clarity)
Retype new SMB password: fishlips (not actually echoed, just here
for clarity)
Password changed for user username.
#
3. edit the /usr/local/samba/private/smbpasswd file with vi, and find
the entry for the user whose password you just changed. You will
notice that it has the following format:
username:5758:A39FDF60A9518E7D02657A8D8EF025E2:65AD8B90AE8636FA1499E091B6B16
E31:[U ]:LCT-00000000:username,location,phone
the encrypted password fields (the data will be different, based
on what you fed smbpasswd command when you changed the passwd)
are the third and fourth fields, in the example above,
A39FDF60A9518E7D02657A8D8EF025E2:65AD8B90AE8636FA1499E091B6B16E31
4. Note that all other entries in the smbpasswd file have these
fields set to all "X"'s:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5. what you want to do at this point, is replace the default passwd
fields (the "X"'s) with your new initial encrypted passwd fields.
To do this in vi, you can use the following command:
:1,$
s/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/A39FDF60
A9518E7D02657A8D8EF025E2:65AD8B90AE8636FA1499E091B6B16E31/
(all the above on a single line in vi)
obviously, a judicious use of cut and paste would be helpful
here...
Then save your changes.
6. after this, every user in your smbpasswd file will have the
same initial password as what you set for 'username'. And
they will be able to log to unix with their unix username and
use the smbpasswd command to change this initial password to one
of their own choosing.
There are probably a million different ways to skin this cat, James; but
this is
the one I used once...
Hope this helps,
Don
-----Original Message-----
From: jallen at entrodyne.com [mailto:jallen at entrodyne.com]
Sent: Wednesday, March 28, 2001 4:23 PM
To: samba-ntdom at lists.samba.org
Subject: New Samba Install / Replicating UNIX Passwords Over to
smbpasswd File
I have recently installed and begun configuring Samba for the first time.
The Samba server (smbd) is configured and
running on my UNIX box.
However, I am in the process of replicating my UNIX /etc/passwd file over
to my Samba smbpasswd file. I have attempted
to use the addtosmbpass script, but to no avail. The syntax that I am using
to follow:
addtosmbpass /etc/passwd /opt/samba/lib/smbpasswd
I have also tried the smbpasswd program and enter the individual passwords.
This is not working either.
Does anyone have a trick or pointers on the quickest way to get my UNIX
/etc/passwd passwords into my samba
smbpasswd file? ?
I have been following the online documentation as well as the documentation
found in the "Using Samba" book.
I am also having a few problems getting the NT server to authenticate
itself with the UNIX/Samba server and
visa versa.
It would be wonderful if someone could give me a call. Especially if they
have gone through the same ordeal that I am
going through.
Sincerely,
James C. Allen Jr.
Systems Network Administrator
Entrodyne Corporation
225 South Magnolia Avenue
Buena Vista, VA 24416
Tel: (540) 261-5595 xt: 365 Fax: (540) 261-1000
Email: jallen at entrodyne.com
More information about the samba-ntdom
mailing list