Koozali.org: home of the SME Server
Obsolete Releases => SME Server 7.x => Topic started by: mjlyon on May 27, 2009, 05:59:41 PM
-
Does anyone have any experience using perl or any other regular expression parsers to convert an /etc/passwd file into a format compatible for use with lat-users so I can batch import?
-
Does anyone have any experience using perl or any other regular expression parsers to convert an /etc/passwd file into a format compatible for use with lat-users so I can batch import?
I am not sure if the /etc/passwd file contains enough information, have a look at the examples in /usr/doc/lazy-admin-tools/ it seems that you need at least the login name, firstname and lastname, the first is in there, the latter two could be in there but it is one field, so you would need to define what you want to do with that field, split it where possible, or do not split at all and add it to either firstname or lastname field.
This is just from looking at the docs as I have never used the toolkit.
-
A little google-ing on 'awk etc passwd' results in this page: http://www.ibm.com/developerworks/library/l-awk1.html
From which you could device some minimal example like this for instance:
awk -F":" '{ print $1 "|" $5 }' /etc/passwd
which would output something like this:
[root@smetest-i386 ~]# awk -F":" '{ print $1 "|" $5 }' /etc/passwd
root|root
bin|bin
daemon|daemon
adm|adm
lp|lp
mail|mail
news|news
uucp|uucp
operator|operator
games|games
gopher|gopher
ftp|FTP User
nobody|Nobody
dbus|System message bus
vcsa|virtual console memory owner
mysql|MySQL Server
alias|
qmaild|
qmaill|
qmailp|
qmailq|
qmailr|
qmails|
haldaemon|HAL daemon
apache|Apache
ldap|LDAP User
pcap|
nut|Network UPS Tools
clamav|Clam Anti Virus Checker
www|e-smith web server
admin|e-smith administrator
public|e-smith guest
smelog|sme log user
ntp|
rpm|
cvmlog|cvm output log user
dnscache|DNScache user
dnslog|DNS log user
dovecot|dovecot
stunnel|chrooted stunnel user user
imaplog|imap output log user
radiusd|radiusd user
sshd|Privilege-separated SSH
squid|
smelastsys|sme last system user marker
dns|Name server
qpsmtpd|qpsmtpd system user
spamd|spamassassin daemon user
[root@smetest-i386 ~]#