I'm trying to read from a file and add to LDAP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting I'm trying to read from a file and add to LDAP
# 1  
Old 09-10-2005
I'm trying to read from a file and add to LDAP

Hi all
I'm trying to write a script that reads from a file and then insert the record by a command line tool into LDAP. here is the file format

FirstName LastName uid password

and here is the script that I wrot:

#!/bin/sh
INPUT='/export/home/user/input'

while read fname lname uid pass
do
imadmin user create -D ServiceAdmin -w **** -n domain.com -d sub.domain.com -F [${fname}] -L [${lname}] -l [${uid}] -W [${pass}] -H mail.domain.com
done < "${INPUT}"

the problem that I faced is that I got this messege:

stty: : Inappropriate ioctl for device

but the record was sccessfully enterd

What does the message mean? what did I do wrong ?

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to add new server into ldap?

Hello Admins, I need help in adding newly built solaris 10 zone into LDAP server. We have LDAP server running on Solaris 10. We just built new solaris zone and would like to add it to LDAP server. The LDAP serves as centralized user administration. Please let me know the steps. (1 Reply)
Discussion started by: snchaudhari2
1 Replies

2. Shell Programming and Scripting

Read file and add it into part of file

Hello let me explain senario. there is a file which name is config and it store main software variable: file main.conf contents: update="1" log_login="0" allow_ports="" deny_ports="21,22,23" and there is a file which name is ports.txt file ports.txt contents: 25,26,27 i... (3 Replies)
Discussion started by: nimafire
3 Replies

3. Solaris

LDAP Client not connecting to LDAP server

I have very limited knowledge on LDAP configuration and have been trying fix one issue, but unsuccessful. The server, I am working on, is Solaris-10 zone. sudoers is configured on LDAP (its not on local server). I have access to login directly on server with root, but somehow sudo is not working... (9 Replies)
Discussion started by: solaris_1977
9 Replies

4. Red Hat

How to add ldapusers in ldap server?

after configured ldap server with 5 user name ldapuser1 ldapuser2 ldapuser3 ldapuser4 ldapuser5 i have configured ldap client in client pc, this five users sucessfully login in client pc, now i want add one more user ldapuser6 how to add (0 Replies)
Discussion started by: ainstin
0 Replies

5. Shell Programming and Scripting

Read a file, add some text and send an email

Hi, If I am asking this question, you must have already figured out , that I am new to Unix, so here it goes I was trying to read a file, add some user defined content to it and send out an email , I did find out a way to achieve this, but looking at the code, it looks a bit crude to me, can... (3 Replies)
Discussion started by: karthikbhuvana
3 Replies

6. Programming

Read file and add value

i have a file outfile.txt which contain 12 22 i have written this program to read the file and show the output,but i dont know how to add these value and show the total. my-codes are #include<cmath> #include<cstdlib> #include<iostream> #include<fstream> using namespace std; int main ()... (4 Replies)
Discussion started by: console
4 Replies

7. UNIX for Dummies Questions & Answers

When reading a csv file, counter to read 20 lines and wait for minute then read next 20 till end

Hello All, i am a newbie and need some help when reading a csv file in a bourne shell script. I want to read 10 lines, then wait for a minute and then do a reading of another 10 lines and so on in the same way. I want to do this till the end of file. Any inputs are appreciated ... (3 Replies)
Discussion started by: victor.s
3 Replies

8. Shell Programming and Scripting

Read file and for each line replace two variables, add strings and save output in another file

Hi All, I have a file, let's call it "info.tmp" that contains data like this .. ABC123456 PCX333445 BCD789833 I need to read "info.tmp" and for each line add strings in a way that the final output is put /logs/ua/dummy.trigger 'AAA00001.FTP.XXX.BLA03A01.xxxxxx(+1)' where XXX... (5 Replies)
Discussion started by: Andy_ARG
5 Replies

9. Programming

Cannot read a file with read(fd, buffer, buffersize) function

# include <stdio.h> # include <fcntl.h> # include <stdlib.h> # include <sys/stat.h> int main(int argc, char *argv) { int fRead, fPadded, padVal; int btRead; int BUFFSIZE = 512; char buff; if (argc != 4) { printf ("Please provide all of the... (3 Replies)
Discussion started by: naranja18she
3 Replies

10. Solaris

sudoers file with groups in LDAP

Hello gurus, I've been working on a sudoers file to work with groups in LDAP. I've created the groups in LDAP and added the users to there respective groups. I've also setup my sudoers file to have the groups match what is in LDAP. And I've added ldap to nsswitch.conf in the group line. The... (6 Replies)
Discussion started by: em23
6 Replies
Login or Register to Ask a Question
ldapscripts(5)							File Formats Manual						    ldapscripts(5)

NAME
ldapscripts - Scripts to manage POSIX accounts in your LDAP directory. DESCRIPTION
The ldapscripts are a set of shell (sh) scripts designed to manage POSIX accounts in an OpenLDAP directory. They can be used as standalone tools or within Samba 3.x's smb.conf file. REQUIREMENTS
The main requirements are the OpenLDAP client tools (ldapadd, ldapsearch, ldapdelete, ...). Other commands are called in the scripts but should come with your OS (sed, grep, cut, ...). CONFIGURATION
The main configuration of the ldapscripts is usually the file /etc/ldapscripts/ldapscripts.conf (or /usr/local/etc/ldapscripts/ldap- scripts.conf, depending on your system). Modify it to fit your needs before using the scripts. Each script also uses a "runtime" file, usu- ally /usr/lib/ldapscripts/runtime (or /usr/local/lib/ldapscripts/runtime). You don't need to modify this file. TEMPLATES
Each script that adds information to the directory uses a template. Templates are directly embedded at the end of the scripts but it is also possible to use external template files (see GTEMPLATE, UTEMPLATE and MTEMPLATE variables in the configuration file). Each template consists of a preformatted LDIF file using special keywords that will be replaced on-the-fly. Sample files are provided for your conve- nience : ldapaddgroup.template.sample, ldapadduser.template.sample and ldapaddmachine.template.sample. It is strongly advised to use those files instead of modifying the embedded (default) templates in the scripts. Sample templates include every keyword you can use. One special additional keyword is the <ask> keyword that will trigger user input to get the attribute value interactively. USING AS STANDALONE TOOLS
Each script can be used as a standard command-line tool. Check their man pages to get help. USING WITH SAMBA 3.x Each Samba 3.x smb.conf "xxx script" option has a matching script. Modify you smb.conf file this way to call them : # [...] add machine script = /usr/local/sbin/ldapaddmachine '%u' sambamachines add user script = /usr/local/sbin/ldapadduser '%u' sambausers add group script = /usr/local/sbin/ldapaddgroup '%g' add user to group script = /usr/local/sbin/ldapaddusertogroup '%u' '%g' delete user script = /usr/local/sbin/ldapdeleteuser '%u' delete group script = /usr/local/sbin/ldapdeletegroup '%g' delete user from group script = /usr/local/sbin/ldapdeleteuserfromgroup '%u' '%g' set primary group script = /usr/local/sbin/ldapsetprimarygroup '%u' '%g' rename user script = /usr/local/sbin/ldaprenameuser '%uold' '%unew' # [...] SEE ALSO
ldapdeletemachine(1), ldapmodifymachine(1), ldaprenamemachine(1), ldapadduser(1), ldapdeleteuserfromgroup(1), ldapfinger(1), ldapid(1), ldapmodifyuser(1), lsldap(1), ldapaddusertogroup(1), ldaprenameuser(1), ldapinit(1), ldapsetpasswd(1), ldapaddgroup(1), ldapdeletegroup(1), ldapsetprimarygroup(1), ldapmodifygroup(1), ldaprenamegroup(1), ldapaddmachine(1), ldapdeleteuser(1). AVAILABILITY
The ldapscripts are provided under the GNU General Public License v2 (see COPYING for more details). The latest version of the ldapscripts is available on : http://contribs.martymac.org BUGS
Sometimes, that kind of message may appear in the log file : Additional information: value does not conform to assertion syntax . Setting slapd's debug level to 32 shows additional details : get_ava: illegal value for attributeType uidNumber . This is *not* a bug : the ldap- scripts tend to use the power of LDAP filters to easily find users (or groups) using either a uidNumber (numerical value) or a uid (string value). The following filter (used by ldapfinger(1)) will generate the above message if $_USER is a login : "(|(&(objectClass=posixAc- count)(|(uid=$_USER)(uidNumber=$_USER))) (&(objectClass=posixGroup)(|(cn=$_USER)(gidNumber=$_USER))))" because filter part "(uidNum- ber=$_USER)" requires an integer but gets a string. You can mostly ignore those warnings. January 1, 2006 ldapscripts(5)