Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Fedora Directory (http://www.linux-archive.org/fedora-directory/)
-   -   what is the best way to a new user and put him in to few groups? (http://www.linux-archive.org/fedora-directory/690461-what-best-way-new-user-put-him-few-groups.html)

Paul Robert Marino 08-03-2012 11:01 PM

what is the best way to a new user and put him in to few groups?
 
well that really depends on what you are comfortable doing as far as code
an ldif piped the the ldap modify command is probably the easiest to
write however you could make something far more robust with the
NET::LDAP Perl module.
The one bad note about the Net::Ldap Perl module is it tends to take a
lot of lines of code to implement things that should be rather simple.
On the bright side there are a ton of other tools for 389 server that
were written using the module so there is a lot of examples and
experienced programers you can draw on for assistance.


On Fri, Aug 3, 2012 at 3:23 PM, Fosiul Alam <fosiul@gmail.com> wrote:
> Hi
> I am very new in ldap(Fedora Directory Server)
>
> I need to develop a script to add a new user and put it into few
> groups automatically.
>
> So wondering what would be best way .
> Putting the command in to a script should not be a issue.
> problem is what would be the best way
>
> shall i create ldiif first then insert that ldif into ldap ??
>
> my structure is like this :
> cn=Directory Manager" -w 'testtest' -b "ou=users,l=uk,dc=fosiul,dc=lan"
>
> suppose if i want to create a lidif.. for user John Smith
>
> how the ldif would be ?
> Thanks for your help
> --
> 389 users mailing list
> 389-users@lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/389-users
--
389 users mailing list
389-users@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/389-users

Grzegorz Dwornicki 08-04-2012 09:20 AM

what is the best way to a new user and put him in to few groups?
 
The best way in my opinion is to generate template using migration tools. Then when you want to add new user use sed to modify it and pipe result to ldapmodify or target it with -a option in ldapadd command. New passwords you can generate using slappasswd or ldappasswd (after user is added to ldap). Please rea man pages of this commands. Slappasswd is part of openldap-severs.



You could use echo to write the same content to ldif file but is this a big diference? If you prefer using echo this way is still good because you will get example user ldif.


Greg.


Message send from htc desire

04-08-2012 01:15, "Fosiul Alam" <fosiul@gmail.com> napisał(a):
Hi thanks
I m thinking to use simple bash script to create a ldif file.I think that canbe done .. But could you please tell me what would be the structure of ldif file , suppose if i want to create a user call john smith under bellow structure
ou=users,l=uk,dc=fosiul,dc=lan"
Thanks



On 4 Aug 2012, at 00:01, Paul Robert Marino <prmarino1@gmail.com> wrote:


ou=users,l=uk,dc=fosiul,dc=lan"
--

389 users mailing list

389-users@lists.fedoraproject.org

https://admin.fedoraproject.org/mailman/listinfo/389-users

--
389 users mailing list
389-users@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/389-users

Fosiul Alam 08-04-2012 01:33 PM

what is the best way to a new user and put him in to few groups?
 
Hi thanks

i am thinking to create ldif file by script .. but i am quite confused
how the ldif will be for my structure..

when i do the ldap search i get this


ldapsearch -xZZ -D "cn=Directory Manager" -w 'testtest' -b
"ou=users,l=uk,dc=fosiul,dc=lan" uidNumber=1000
# extended LDIF
#
# LDAPv3
# base <ou=users,l=uk,dc=fosiul,dc=lan> with scope subtree
# filter: uidNumber=1000
# requesting: ALL
#

# falam, users, UK, fosiul.lan
dn: uid=falam,ou=users,l=UK,dc=fosiul,dc=lan
givenName: Fosiul
sn: Alam
loginShell: /bin/bash
uidNumber: 1000
gidNumber: 6000
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetorgperson
objectClass: posixAccount
uid: falam
cn: Fosiul Alam
homeDirectory: /home/falam
userPassword:: e1NTSEF9MkpYSGI2bSs3OFk5SlcySG1kOVcxdjFVUFVHMVA3eX I0dFQvZ2c9PQ=
=

# search result
search: 3
result: 0 Success

# numResponses: 2
# numEntries: 1


So Suppose if i want to create a user call "John Smith"

what would be my ldif ??

Thanks for the help.



On Sat, Aug 4, 2012 at 10:20 AM, Grzegorz Dwornicki <gd1100@gmail.com> wrote:
> The best way in my opinion is to generate template using migration tools.
> Then when you want to add new user use sed to modify it and pipe result to
> ldapmodify or target it with -a option in ldapadd command. New passwords you
> can generate using slappasswd or ldappasswd (after user is added to ldap).
> Please rea man pages of this commands. Slappasswd is part of
> openldap-severs.
>
> You could use echo to write the same content to ldif file but is this a big
> diference? If you prefer using echo this way is still good because you will
> get example user ldif.
>
> Greg.
>
> Message send from htc desire
>
> 04-08-2012 01:15, "Fosiul Alam" <fosiul@gmail.com> napisał(a):
>>
>> Hi thanks
>>
>> I m thinking to use simple bash script to create a ldif file.
>> I think that canbe done .. But could you please tell me what would be the
>> structure of ldif file , suppose if i want to create a user call john smith
>> under bellow structure
>>
>> ou=users,l=uk,dc=fosiul,dc=lan"
>>
>>
>> Thanks
>>
>>
>>
>> On 4 Aug 2012, at 00:01, Paul Robert Marino <prmarino1@gmail.com> wrote:
>>
>> ou=users,l=uk,dc=fosiul,dc=lan"
>>
>>
>> --
>> 389 users mailing list
>> 389-users@lists.fedoraproject.org
>> https://admin.fedoraproject.org/mailman/listinfo/389-users
>
>
> --
> 389 users mailing list
> 389-users@lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/389-users



--
Regards
Fosiul Alam
07877100621
http://www.fosiul.co.uk
--
389 users mailing list
389-users@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/389-users


All times are GMT. The time now is 10:10 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.