Difference between revisions of "Linking to Active Directory Home Directories using CentrifyDN"

From ubermix Wiki
Jump to: navigation, search
m
m
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
'''See Article:''' http://community.centrify.com/t5/DirectControl-Express-for-UNIX/Automounting-home-directories-defined-in-AD/td-p/1044
 
'''See Article:''' http://community.centrify.com/t5/DirectControl-Express-for-UNIX/Automounting-home-directories-defined-in-AD/td-p/1044
 +
 +
''' * Disclaimer: I did not create (write) this script, or have I tested this well. Please change any errors or omissions in these instructions! * '''
 +
 +
''' * Disclaimer 2. : These instructions on this part *do not work*; I need to create scripts to fix some issues to make this work. Please be patient or create your own scripts to make this section work '''
 +
 +
 +
 +
 +
''' 1. Install SAMBA. '''
 +
 +
'''OPEN TERMINAL with Ctrl-T if it is not already open'''
 +
 +
    sudo -i
 +
 +
    apt-get update
 +
 
 +
    apt-get install samba
 +
 +
''' 2. Create Script with adhome.pl based on article above and place in /usr/bin/adhome.pl '''
 +
 +
''' OPEN TERMINAL with Ctrl-T if it is not already open '''
 +
 +
    sudo -i
 +
 +
    nano /usr/bin/adhome.pl
 +
''' 2a. Copy the Shell Script into adhome.pl '''
 +
 +
  #!/bin/sh /usr/share/centrifydc/perl/run
 +
  #This script uses ldap to fetch user homeDirectory from AD
 +
  #and mount/umount by smbmount and smbumount
 +
       
 +
  use strict;
 +
  use File::Spec;
 +
     
 +
  my $zone_base = `cat /var/centrifydc/kset.zonename`; # changed va to var
 +
       
 +
  my $cn = `adquery user -D ${ARGV[0]} | cut -d, -f1`;
 +
     
 +
  my @cn = split(/\n/,$cn);
 +
 
 +
  my $ldap = `/usr/share/centrifydc/bin/ldapsearch -Q -H "LDAP://" -b "$zone_base"  -LLL "(@cn)" homeDirectory |  grep homeDirectory | cut -d: -f2 | sed 's:\\\\:/:g' `;
 +
 
 +
  my @line = split(/\n/, $ldap);
 +
 
 +
  if (@line )
 +
  {
 +
      if(${ARGV[2]} eq "mount")
 +
      {
 +
 
 +
      my $mount = `smbmount @line ${ARGV[1]} -o sec=krb5i`;
 +
 
 +
      }
 +
  }
 +
 
 +
  if(${ARGV[2]} eq "umount" )
 +
  {
 +
 
 +
    my $mount = `smbumount ${ARGV[1]}`;
 +
 
 +
  }
 +
 +
''' -- WORK IN PROGRESS -- '''

Latest revision as of 21:18, 10 May 2012

See Article: http://community.centrify.com/t5/DirectControl-Express-for-UNIX/Automounting-home-directories-defined-in-AD/td-p/1044

* Disclaimer: I did not create (write) this script, or have I tested this well. Please change any errors or omissions in these instructions! *

* Disclaimer 2. : These instructions on this part *do not work*; I need to create scripts to fix some issues to make this work. Please be patient or create your own scripts to make this section work



1. Install SAMBA.

OPEN TERMINAL with Ctrl-T if it is not already open

   sudo -i
   apt-get update
  
   apt-get install samba

2. Create Script with adhome.pl based on article above and place in /usr/bin/adhome.pl

OPEN TERMINAL with Ctrl-T if it is not already open

   sudo -i
   nano /usr/bin/adhome.pl

2a. Copy the Shell Script into adhome.pl

  #!/bin/sh /usr/share/centrifydc/perl/run
  #This script uses ldap to fetch user homeDirectory from AD 
  #and mount/umount by smbmount and smbumount
       
  use strict;
  use File::Spec;
     
  my $zone_base = `cat /var/centrifydc/kset.zonename`; # changed va to var
        
  my $cn = `adquery user -D ${ARGV[0]} | cut -d, -f1`;
     
  my @cn = split(/\n/,$cn);
  
  my $ldap = `/usr/share/centrifydc/bin/ldapsearch -Q -H "LDAP://" -b "$zone_base"  -LLL "(@cn)" homeDirectory |  grep homeDirectory | cut -d: -f2 | sed 's:\\\\:/:g' `;
  
  my @line = split(/\n/, $ldap);
  
  if (@line )
  {
     if(${ARGV[2]} eq "mount") 
     {
  
      my $mount = `smbmount @line ${ARGV[1]} -o sec=krb5i`;
  
     }
  }
  
  if(${ARGV[2]} eq "umount" )
  {
  
   my $mount = `smbumount ${ARGV[1]}`;
  
  }

-- WORK IN PROGRESS --