UNIX to SQL to LDAP

UNIX type operating systems manage users, groups and their respective relationships in three different text files:

/etc/passwd

Users being defined on the system:

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
...

We illustrate the meaning of this CSV (actually **character** separated) by examining the first row:

Column 1, root:

The user's unique system name as being entered at login.

Column 2, x:

This field is not being used on current UNIX implementations. Historically either the user's clear text password or its hash value was present here. For security reasons this attribute has been moved to a third file /etc/shadow being read access protected to non-administrator users.

Column 3, 0:

The user's unique integer numerical uid number value.

Column 4, 0:

The user's unique primary group integer numerical gid number value. The value 0 here refers to a group root of identical name being defined in /etc/group, see next section.

Column 5, root:

The user's common name. For a regular user account this might be Jim Beam for example.

Column 6, /root:

The user's home directory. Might be /home/beam for a user Jim Beam.

Column 7, /bin/bash:

The user's login shell (command interpreter. This attribute contains a reference to a command interpreter like /bin/(t)csh, /bin/ksh and so on.

/etc/group

This file contains all groups being defined on the system:

root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:syslog,mi 
tty:x:5:
...

Column1,root:

The group's name

Column 2, x:

Not used

Column 3, 4:

The group's unique gid number

Column 4, syslog,mi:

The set {syslog,mi} ❶ defines secondary group memberships: These two users will belong to the group adm in addition to their respective primary group definition.

exercise No. 4

Exporting and importing data

Q:

Write two applications being able to perform the following tasks:

  1. Import the previously described UNIX user and group data ton an RDBMS using JDBC. You will have to define a suitable SQL schema first.

  2. Transfer RDBMS data to your local LDAP server using JNDI.

A: