Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 664
  • Last Modified:

Samba SUSE 9.3 users

How can i automatically create a large number (600) of samba users for my network running a SUSE 9.3. Presently i already have the users in a MYSQL database and i will be happy to use any other approach  approach to create all the user accounts automatically.

2 Solutions
Hello hautine,

I'm not sure how to call upon MySQL from a command line, but if you could export the users to a text list, called users.txt - you run a script, something like this...

for i in `cat users.txt`
   # create the linux user account
   # primary group smbusers, no home dir, no shell (change these options at your leisure)
   useradd -g smbusers -M -s /dev/null $i
   # add the samba user with no password
   smbpasswd -a -n $i

If you want to add a password, for each samba user, I'm not sure how to stick it on the command line - but I'm sure someone else mght be able to help.  Oh yeah, the script is untested!

Steve :)
You don't have to export / import users as Samba is able to use MySQL for authentication.

The following link is regarding free-bsd with samba & mysql, but it's also usable for Linux: http://www.freebsddiary.org/samba-pam.php
This link could be useful as well: http://lists.samba.org/archive/samba/2004-June/086936.html

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now