- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- /etc/passwd to LDIF
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 11:03 AM
11-24-2009 11:03 AM
/etc/passwd to LDIF
I had an Red Hat 8.0 LDAP server configured and it is working fine, however, I wonder if there is a tool or script to migrate the server's /etc/passwd entries to LDIF format where it can be imported to the LDAP server... I have several thousands of users on this machine and hope there a way of not doing it manually.
Thanks,
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 11:24 AM
11-24-2009 11:24 AM
Re: /etc/passwd to LDIF
Identify the format that the Red Hat LDAP server can import and then write a littl awk script to write a file in the appropriate format.
There are a lot of more slick ways to do this but.
while read -r DL
do
username=$(awk -F: '{ print $1 }')
numuser=$(awk -F: '{ print $3 }')
groupid=$(awk -F: '{ print $4 }')
# repeat for other fields.
DO="${username},${numuser},${groupid}"
echo DO >> /tmp/exportfile
done < /etc/passwd
I bet someone can do this totally with awk and no while loop.
awk -F: '{print $1 $3 $4 $5}' steve
steve being a copy of /etc/passwd.
Add a little formating and you are done.
SEP
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 11:30 AM
11-24-2009 11:30 AM
Re: /etc/passwd to LDIF
Isn't there any way to import the user's passwords as well? And if not with Red Hat Directory Server, then might be that OpenLDAP can do this? I would prefer to reinstall the LDAP server with different brand than to set those 3000 passwords manually :-(
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 11:34 AM
11-24-2009 11:34 AM
Re: /etc/passwd to LDIF
Passwords are encrypted, and I do not believe they can be exported. Normally the procedure for such a situation would be to set the users with new temporary passwords in the LDAP server.
This is better handled via procedures.
Could you crack the user passwords? Probably, but it could take weeks and would violate many good practices.
More awk fun.
awk -F: '{printf("%8s %5s %4s\n",$1,$3,$4)}' steve
I'm in serious awk mode today. The weather in Toledo is awkful.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 01:34 PM
11-24-2009 01:34 PM
Re: /etc/passwd to LDIF
I've done a bit of LDAP scripting in the past.
It actually is possible to do a script that resets the password, and emails the user a temporary password and instructions.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2009 08:10 AM
11-25-2009 08:10 AM
Re: /etc/passwd to LDIF
https://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=J4269AA
Red Hat DS 8.0 and HP-UX DS 8.1 support crypt password hashing and the migrate_passwd.pl script will migrate passwords by simply prefixing the hash with {crypt}. Crypt passwords might not be portable across platforms, in particular Linux doesn't use traditional UNIX crypt, but crypt values from passwd on HP-UX to RHDS 8.0 on HP-UX should be fine.