Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Deletion of list of user based on a text file In LDAP UNIX server Post 302960735 by zaxxon on Thursday 19th of November 2015 04:54:59 AM
Old 11-19-2015
Please use code tags in future when posting commands, logs, data etc. I have changed this in your post already.

You might want to use a loop like a while/read around the command ldapdelete and feed it with that list.
Though to be better safe than sorry you will have a small list of users to delete (let's say 3 of them), instead of all 15.000.

Here you can find the syntax: The ldapsearch, ldapdelete and ldapmodify utilities

It will basically look like this, where you have to change the list and the echo to ldapdelete with the correct command switches etc.:
Code:
$ cat infile
will
martha
pete
$ while read LINE; do echo $LINE; done < infile
will
martha
pete

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File deletion when server restarts

Hi, In a shell script I am makin use of 3 files f1,f2 and f3.txt. When the Unix server is restarted I want to delete all these 3 files if they are existing. ( I suppose I will have to use this command rm /thefilepath/f* but dont know in which script to use.) Anyone knows what can be... (6 Replies)
Discussion started by: k_oops9
6 Replies

2. Solaris

Script for automatic deletion of trash file of mail server

Hi, I have a mail server with limited space and operating system is sun solaris 8 (sparc). I do not have provisions to increase the space for home directory. So i have to delete files from /home/username/mail/trash which are more than 10 days old automatically. So my script should be like... (1 Reply)
Discussion started by: crown2100bd
1 Replies

3. Shell Programming and Scripting

Deletion of lines in a text file

Hi Everyone, Please help me with this. I have gone through many posts here but couldn't find what I wanted. I have a file with 79000+ lines and I want to delete lines in a pattern. I want to delete every 141st line in the file, starting from line 2000 till 50000. Please help guys. ... (8 Replies)
Discussion started by: max29583
8 Replies

4. Shell Programming and Scripting

Delete block of text in one file based on list in another file

Hi all I currently use the following in shell. #!/bin/sh while read LINE do perl -i -ne "$/ = ''; print if !m'Using archive: ${LINE}'ms;" "datafile" done < "listfile" NOTE the single quote delimiters in the expression. It's highly likely the 'LINE' may very well have characters in it... (3 Replies)
Discussion started by: Festus Hagen
3 Replies

5. Shell Programming and Scripting

Unix ldapsearch can not contact a Windows LDAP Server

Good morning, Firstly my appologies if this post is not exactly approprate for this forum but I do not know were else to post it. If anyone knows of a better forum for this please let me know. I need to script an ldapsearch that will interrogate both unix and windows ldap servers. When it... (1 Reply)
Discussion started by: twk
1 Replies

6. UNIX for Dummies Questions & Answers

Script for replacing text in a file based on list

Hi All, I am fairly new to the world of Unix, and I am looking for a way to replace a line of text in a file with a delimited array of values. I have an aliases file that is currently in use on our mail server that we are migrating off of. Until the migration is complete, the server must stay... (8 Replies)
Discussion started by: phoenixjc
8 Replies

7. Shell Programming and Scripting

Write a scripts to kill idle user for 60 min. & email user list to admin in text file

Folks, I have written one script for following condition by referring some of online post in this forum. Please correct it if I'm missing something in it. (OS: AIX 5.3) List the idle user. (I used whoidle command to list first 15 user and get username, idle time, pid and login time).... (4 Replies)
Discussion started by: sumit30
4 Replies

8. UNIX for Dummies Questions & Answers

print multiple lines from text file based on pattern list

I have a text file with a list of items/patterns: ConsensusfromCGX_alldays_trimmedcollapsedfilteredreadscontiglist(229095contigs)contig12238 ConsensusfromCGX_alldays_trimmedcollapsedfilteredreadscontiglist(229095contigs)contig34624... (1 Reply)
Discussion started by: Oyster
1 Replies

9. UNIX and Linux Applications

User Based LDAP Client Access

Hi everyone, I am not that familiar with LDAP advanced contents. But since it is a popular secure tool for authentication, I preferred to user RedHat LDAP. The organization has 5 organizational units. There are 3 client servers and I want to limit each client to access different users. So, I... (3 Replies)
Discussion started by: royalliege
3 Replies
LDAPDELETE(1)						      General Commands Manual						     LDAPDELETE(1)

NAME
ldapdelete - LDAP delete entry tool SYNOPSIS
ldapdelete [-n] [-v] [-k] [-K] [-c] [-M[M]] [-d debuglevel] [-f file] [-D binddn] [-W] [-w passwd] [-H ldapuri] [-h ldaphost] [-P 2|3] [-p ldapport] [-O security-properties] [-U authcid] [-x] [-I] [-Q] [-X authzid] [-Y mech] [-Z[Z]] [dn]... DESCRIPTION
ldapdelete is a shell-accessible interface to the ldap_delete(3) library call. ldapdelete opens a connection to an LDAP server, binds, and deletes one or more entries. If one or more DN arguments are provided, entries with those Distinguished Names are deleted. Each DN should be provided using the LDAPv3 string representation as defined in RFC 2253. If no dn arguments are provided, a list of DNs is read from standard input (or from file if the -f flag is used). OPTIONS
-n Show what would be done, but don't actually delete entries. Useful for debugging in conjunction with -v. -v Use verbose mode, with many diagnostics written to standard output. -k Use Kerberos IV authentication instead of simple authentication. It is assumed that you already have a valid ticket granting ticket. This option only has effect if ldapdelete is compiled with Kerberos support. -K Same as -k, but only does step 1 of the Kerberos IV bind. This is useful when connecting to a slapd and there is no x500dsa.host- name principal registered with your Kerberos Domain Controller(s). -c Continuous operation mode. Errors are reported, but ldapdelete will continue with deletions. The default is to exit after reporting an error. -M[M] Enable manage DSA IT control. -MM makes control critical. -d debuglevel Set the LDAP debugging level to debuglevel. ldapdelete must be compiled with LDAP_DEBUG defined for this option to have any effect. -f file Read a series of lines from file, performing one LDAP search for each line. In this case, the filter given on the command line is treated as a pattern where the first occurrence of %s is replaced with a line from file. -x Use simple authentication instead of SASL. -D binddn Use the Distinguished Name binddn to bind to the LDAP directory. -W Prompt for simple authentication. This is used instead of specifying the password on the command line. -w passwd Use passwd as the password for simple authentication. -H ldapuri Specify URI(s) referring to the ldap server(s). -h ldaphost Specify an alternate host on which the ldap server is running. Deprecated in favor of -H. -p ldapport Specify an alternate TCP port where the ldap server is listening. Deprecated in favor of -H. -P 2|3 Specify the LDAP protocol version to use. -r Do a recursive delete. If the DN specified isn't a leaf, its children, and all their children are deleted down the tree. No veri- fication is done, so if you add this switch, ldapdelete will happily delete large portions of your tree. Use with care. -O security-properties Specify SASL security properties. -I Enable SASL Interactive mode. Always prompt. Default is to prompt only as needed. -Q Enable SASL Quiet mode. Never prompt. -U authcid Specify the authentication ID for SASL bind. The form of the identity depends on the actual SASL mechanism used. -X authzid Specify the requested authorization ID for SASL bind. authzid must be one of the following formats: dn:<distinguished name> or u:<username> -Y mech Specify the SASL mechanism to be used for authentication. If it's not specified, the program will choose the best mechanism the server knows. -Z[Z] Issue StartTLS (Transport Layer Security) extended operation. If you use -ZZ, the command will require the operation to be success- ful. EXAMPLE
The following command: ldapdelete "cn=Delete Me, dc=example, dc=com" will attempt to delete the entry named with commonName "Delete Me" directly below the "dc=example, dc=com" entry. Of course it would prob- ably be necessary to supply authentication credentials. DIAGNOSTICS
Exit status is 0 if no errors occur. Errors result in a non-zero exit status and a diagnostic message being written to standard error. SEE ALSO
ldap.conf(5), ldapadd(1), ldapmodify(1), ldapmodrdn(1), ldapsearch(1), ldap(3), ldap_delete(3) BUGS
There is no interactive mode, but there probably should be. AUTHOR
The OpenLDAP Project <http://www.openldap.org/> ACKNOWLEDGEMENTS
OpenLDAP is developed and maintained by The OpenLDAP Project (http://www.openldap.org/). OpenLDAP is derived from University of Michigan LDAP 3.3 Release. OpenLDAP 2.0.27-Release 20 August 2001 LDAPDELETE(1)
All times are GMT -4. The time now is 05:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy