Solved

Creating a script for adding samba/ldap users

Posted on 2009-05-20
4
673 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
ID: 24430029
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
ID: 24430077
I really need my script to be able to autogenerate the password, not a predefined bulk script
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24430187
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
ID: 24430195
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface There are many applications where some computing systems need have their system clocks running synchronized within a small margin and eventually need to be in sync with the global time. There are different solutions for this, i.e. the W3…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

22 Experts available now in Live!

Get 1:1 Help Now