Solved

Creating a script for adding samba/ldap users

Posted on 2009-05-20
4
670 Views
Last Modified: 2013-12-02
I need to have a script to use for adding users to my samba PDC, which is integrated with ldap.

this script i have added is not working becouse it doesnt add a password, i need a command that adds a password too, so i can add several users from a text file.

Or else i cant get this users to log in to the domain, please help!
#!/bin/sh
 
 

IFS="

"
 

for line in `cat $1`;do
 

username=$line
 

smbldap-useradd -m $username
 

done

Open in new window

0
Comment
Question by:leeds2000
  • 2
  • 2
4 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
Hi,

do you know these?
- quoting -
There are two scripts in the smbldap-installer directory to help you add users in bulk: create-usernames and smbldap-useradd-bulk.
Here is a neat description -
https://wiki.ubuntu.com/SmbLdapManagingUsers#3
HTH
Cheers
wmp
 
 
0
 
LVL 3

Author Comment

by:leeds2000
Comment Utility
I really need my script to be able to autogenerate the password, not a predefined bulk script
0
 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
Since neither smbldap-useradd nor smbldap-usermod provide such a functionality, I'd really advise you to re-read the link I posted.
0
 
LVL 3

Accepted Solution

by:
leeds2000 earned 0 total points
Comment Utility
ive figured out a easy way to do it, thanks for the help anyway.
#!/bin/sh
 
 

IFS="

"
 

for line in `cat $1`;do
 

username=$line
 

echo $username > passord.txt

echo $username >> passord.txt

smbldap-useradd -a -m $username
 

smbldap-passwd $username < passord.txt
 

rm passord.txt

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now