pdadmin script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting pdadmin script
# 1  
Old 06-11-2009
pdadmin script

Hello all,

I would need a scirpt to perform the following operation:
  1. I would like to give a spreadsheet as input with 3 columns with firstname,lastname,userid in order
  2. The script should read from the spreadsheet and search if each user exists in particular groups "Group1" by using the command user show-groups userx and grep for group group1.If user has group1 then continue with the following commands :

  • pdadmin -a sec_master -p XXXXX user modify userx password passwordx
  • pdadmin -a sec_master -p XXXXX user modify userx password-valid no
or

If the user doesnt belong to the group group1 then do the following commands:

  • pdadmin -a sec_master -p XXXXX group modify group1 add userx
  • pdadmin -a sec_master -p XXXXX user modify userx account-valid yes
  • pdadmin -a sec_master -p XXXXX user modify userx password passwordx
  • pdadmin -a sec_master -p XXXXX user modify userx password-valid no
The values of XXXXX,group1,passwordx should be requested when the script is run.

Last edited by sophos; 06-11-2009 at 01:44 PM..
# 2  
Old 06-11-2009
geewiz ~~ I would like a pony

This is not a free script writing site "come and get you dreams filled." What have you done to make this script happen?
# 3  
Old 06-11-2009
i have tried a bit as follows but wondering if there is a easier way:

#!/usr/bin/perl


#Clears Screen
$CLEAR=`clearscreen`;
print $CLEAR;

#Set LDAPDomain
$DOMAIN="ou=people,o=xxxxxx,c=us";

# Collect user name
print "Please enter user file >>";
$FILE=<STDIN>;
chomp($FILE);

#print "Please enter the user's First Name>>";
#$FNAME=<STDIN>;
#chomp($FNAME);
#print "Please enter the user's Last Name>>";
#$LNAME=<STDIN>;
#chomp($LNAME);


# Collect Groups
print "Please enter groups to add user too, Seperated by a comma(,)>>";
#$GROUPS=<STDIN>;
#chomp($GROUPS);
#@GROUPLIST=split(/,/,$GROUPS);
#$USERNAME=~s/\n//;
#$GROUPLISTCOUNT=scalar(@GROUPLIST);
#print $GROUPLISTCOUNT;

#Collect Admin Username
$SEC_USER=<STDIN>;
chomp($SEC_USER);
#$SEC_USER=~s/\n//;
$COMMAND4=`pdadmin -a $SEC_USER -p $SEC_PASS user create $USERNAME cn=$USERNAME,
$DOMAIN $FNAME $LNAME $PASS_RESET`;
$COMMAND5=`pdadmin -a $SEC_USER -p $SEC_PASS user modify $USERNAME account-valid
yes`;
$COMMAND6=`pdadmin -a $SEC_USER -p $SEC_PASS user modify $USERNAME password-vali
d yes`;
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies

2. Shell Programming and Scripting

Shell script works fine as a standalone script but not as part of a bigger script

Hello all, I am facing a weird issue while executing a code below - #!/bin/bash cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset sh UKBA_publish.sh UKBA 28082015 3 if then echo "Param file conversion for all the areas are completed, please check in your home directory"... (2 Replies)
Discussion started by: ektubbe
2 Replies

3. UNIX for Dummies Questions & Answers

Calling a script from master script to get value from called script

I am trying to call a script(callingscript.sh) from a master script(masterscript.sh) to get string type value from calling script to master script. I have used scripts mentioned below. #masterscript.sh ./callingscript.sh echo $fileExist #callingscript.sh echo "The script is called"... (2 Replies)
Discussion started by: Raj Roy
2 Replies

4. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

5. Shell Programming and Scripting

pdadmin script help needed

Hello all, I need to create a report for the list of users and related groups present in my ldap directory. I need a script which does the following and give out a final script as specified. Any help is appreciated. 1)pdadmin -a sec_master -p <passwd> group show-members <groupname> >>... (11 Replies)
Discussion started by: sophos
11 Replies

6. Shell Programming and Scripting

create a shell script that calls another script and and an awk script

Hi guys I have a shell script that executes sql statemets and sends the output to a file.the script takes in parameters executes sql and sends the result to an output file. #!/bin/sh echo " $2 $3 $4 $5 $6 $7 isql -w400 -U$2 -S$5 -P$3 << xxx use $4 go print"**Changes to the table... (0 Replies)
Discussion started by: magikminox
0 Replies
Login or Register to Ask a Question