Author Topic: Import/Export users at reinstall  (Read 13252 times)

dave2318

  • Zen Apprentice
  • *
  • Posts: 48
  • Karma: +3/-0
    • View Profile
Re: Import/Export users at reinstall
« Reply #15 on: July 08, 2014, 06:21:50 pm »
Ok, no probs. (I have a snapshot to revert too and have had to rebuild too often:))
I'm finishing for the day soon. hopefully will have chance to play tomorrow.

StuartNaylor

  • Guest
Re: Import/Export users at reinstall
« Reply #16 on: July 08, 2014, 11:21:20 pm »
Think I got it.

Only thing strange was I had to do it in two sweeps.

Add the objectclass then the attributes.

dave2318

  • Zen Apprentice
  • *
  • Posts: 48
  • Karma: +3/-0
    • View Profile
Re: Import/Export users at reinstall
« Reply #17 on: July 09, 2014, 11:00:01 am »
Wohoooo!!! that worked perfectly, thanks for all your help. I seriously need to bet to grips with bask and samba scripting.

When i get some spare time i need to look into script adding contact records. Again in 3.4 i had this sorted but doesn't work at all in 3.5 :(

StuartNaylor

  • Guest
Re: Import/Export users at reinstall
« Reply #18 on: July 09, 2014, 05:52:28 pm »
Bash and shell (sh) are basic command line interpreters for linux and because they are the most basic I used those without the zentyal object model deliberately.

That should always for unless the schema requirements change.

Zentyal uses perl which is a great tool and way more powerful than bash or sh.

I guess I could of used the Zentyal perl object model but my perl isn't great but I have found the object model changes before I seem to get to grips with things.

If we create a file users.csv and then a series of contact lists username.csv where username is a user contained in users.csv.

Would that be a good way to go?

Also could just create a script to add contacts to a user at any time.

Stuart.

dave2318

  • Zen Apprentice
  • *
  • Posts: 48
  • Karma: +3/-0
    • View Profile
Re: Import/Export users at reinstall
« Reply #19 on: July 09, 2014, 05:59:41 pm »
Yep, my Perl is also very bad (I mainly use batch files and VBScript with a little bit of powershell)

I have a separate contacts.csv that i used to import contact records into LDAP so they were available as a global address list for all users. My plan was to have the script to drop all contact records and recreate them from a CSV (CSV is an export of users from our seperate MS Exchange environment)

StuartNaylor

  • Guest
Re: Import/Export users at reinstall
« Reply #20 on: July 09, 2014, 07:26:59 pm »
If you log into any connected windows client as an admin you can still run your vb scripts against Zentyal.

I haven't tried this and keep meaning to its in a every growing list of bookmarks.
http://windowsitpro.com/powershell/top-10-active-directory-tasks-solved-powershell

http://www.vbsedit.com/scripts/ad/

This is been my main argument for Samba4 and Linux as an extensible platform, its opensource and generally open for any client and method.
Sometimes the main downfall of Linux and opensource is due to us, as all these options cause confusion.

Bahaa! in my best sheep voice of the M$ world as it would seem being led breeds a certain level of success.
« Last Edit: July 10, 2014, 01:31:15 am by StuartNaylor »

dave2318

  • Zen Apprentice
  • *
  • Posts: 48
  • Karma: +3/-0
    • View Profile
Re: Import/Export users at reinstall
« Reply #21 on: July 10, 2014, 12:13:41 pm »
very true. Only problem with that is i would need to setup a VM specifically to add to the Zentyal domain and install the exchange powershell add-on onto it, assuming openchange supports exchange powershell (already have a script to add exchange contacts:))

StuartNaylor

  • Guest
Re: Import/Export users at reinstall
« Reply #22 on: July 10, 2014, 04:22:56 pm »
I presumed when you mentioned vbscript you would have a windows client.

I am sort of platform agnostic it is what ever does the job.

The linux way works as well so all good.

I opened up sogo and tried to add some contacts so I could find where they are in the directory.
(It doesn't seem to work)

I never got round to trying Outlook.
You managed to add to the global contact or make shared contacts?

Its been over ten years since I worked with Exchange and I can't remember very much.

dave2318

  • Zen Apprentice
  • *
  • Posts: 48
  • Karma: +3/-0
    • View Profile
Re: Import/Export users at reinstall
« Reply #23 on: July 10, 2014, 04:26:15 pm »
Yes i use windows client but on different domain:(
I had a script similar to the one i attached at the beginning that added users.

Modification: Attach script
« Last Edit: July 10, 2014, 04:30:40 pm by dave2318 »

koenraad

  • Zen Apprentice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Import/Export users at reinstall
« Reply #24 on: July 11, 2014, 10:59:22 am »
Hi,

Me too, I'm trying to import users in bulk.
I tried to manually add some users with samba-tool to test if that works and for samba it worked. I saw those users in "samba-tool user list".
Then I went to the zentyal-website. The users are there, but I when I select a group to add those users, they're not in the drop-down list.
So my question : using your script, are the imported users visible in the group-management part, could you check please ?
Another problem : the home-directory of that new user does not exist, how do you create that ? I can manually create the directory, but I can't set the ownership with chown. Do I have to use some parameter with chown to get the user and group from the AD ?

StuartNaylor

  • Guest
Re: Import/Export users at reinstall
« Reply #25 on: July 11, 2014, 01:44:07 pm »
I haven't checked to be honest but the home directory should get created when you logon.

If not there is something wrong with the file permissions.
https://wiki.samba.org/index.php/Setting_up_a_home_share

Code: [Select]
homeDirectory: \\zent1.OFFICE.ZENTYAL.LAN\Administrator
homeDrive: H:

Missed those out from the LDIF

/etc/zentyal/sids-to-hide.regex
Contains a list of all groups and users to hide from the user manager

I don't seem to have a problem with groups though.

There is another thing and its the PosixAccount.

To be honest I am totally confused to what zentyal are doing here.

gentent passwd uid and the gid and group ranges is confusing.

Also --use-rfc2307 is enabled but the attributes by zentyal are not used.

As said I am confused by the zentyal attributes and methods?

https://wiki.samba.org/index.php/Using_RFC2307_on_a_Samba_DC
« Last Edit: July 13, 2014, 04:04:24 am by StuartNaylor »

bertalanimre

  • Zen Monk
  • **
  • Posts: 88
  • Karma: +3/-0
    • View Profile
Re: Import/Export users at reinstall
« Reply #26 on: July 14, 2014, 01:19:30 pm »
Didn't think this topic will be so "crowded", but I'm glad we are trying to solve it. :)
I'm also trying the import/export with Apaches directory studio and somehow the export is fine ( I think ), but non-stop getting the following error message at import:
"Error while importing LDIF. The primary group isn't settable on add operations."

Did you experience this error if yes, what was the sollution to it?

StuartNaylor

  • Guest
Re: Import/Export users at reinstall
« Reply #27 on: July 14, 2014, 04:55:18 pm »
https://forum.zentyal.org/index.php/topic,22477.msg86568.html#msg86568

Has a bulkusers3 script that will create users for you.

It needs to be edited as two attributes where missing.

homeDirectory: \\zent1.OFFICE.ZENTYAL.LAN\Administrator
homeDrive: H:

Which need editing to your own requirements
I am finding Apache Directory Studio absolutely indispensable for browsing and copying ldif files.

Had a few problems adding and editing so been using the cli and ldbedit with the scripts supplied.
« Last Edit: July 14, 2014, 05:09:22 pm by StuartNaylor »

bertalanimre

  • Zen Monk
  • **
  • Posts: 88
  • Karma: +3/-0
    • View Profile
Re: Import/Export users at reinstall
« Reply #28 on: July 15, 2014, 10:23:17 am »
Hophophop!

I've found a 3rd party that works like a charm.
Softterra LDAP Administrator can easily export and later import the users without errors.

Upside is:
It will save the OpenChange status + mail address + home directory path as well

Downside:
Passwords has to be reset to all users
home folders has to be created in advance ( tho I didn't tested it yet with exporting from 1 server and importing to another )
Softterra is not a free software... U have to buy it

StuartNaylor

  • Guest
Re: Import/Export users at reinstall
« Reply #29 on: July 15, 2014, 10:47:13 am »
Please don't buy it as it will not work.

I am trying to save you the expenditure.

The bulkusers script works because it uses samba-tool to start the initial AD user.

It then merely adds the extra to the ldap.

You can't just copy and paste.