Home  |  Linux  | Mysql  | PHP  | XML
From:Jyotishmaan Ray Date:Wed Aug 20 13:07:02 2008
Subject:Re: Perl Script Needed To Create The Home Drectories.
 created a user by importing a ldif as shown  below:

Plz go
through this  file. However this file  is located at the LDAP server
and the homedirectories are to created in the cluster server.

dn:
uid=s08-1-5-097,ou=student,dc=nits,dc=ac,dc=in
uid: s08-1-5-097
cn:  s08-1-5-097
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword: {crypt}$1$REie6fpE$5brEKmdMZlWzxStz7Kqed.
loginShell: /bin/bash
uidNumber: 3053
gidNumber: 3053
homeDirectory: /mnt/btech/s08-1-5-097
shadowLastChange:13458
shadowMin: 0
shadowMax: 999999
shadowWarning: 7




I tried excuting the script too, still the /etc/group was not updated , why ?  The script is shown
 below:





#!/usr/local/bin/perl

use strict;
use warnings;

open(FH,"/mnt/btech/rr.txt");
while(<FH>)
 {
   chomp($_);
   my $homedir = "/mnt/btech/$_";
   `groupadd $_`;
   `mkdir "$homedir"; chmod 700 "$homedir";` if(! -e $homedir);
}
close(FH);

what could be wrong with the script ?



While
the same script when i ran in another system where my ldap server is
running, I saw that three rollnos were added from the file-rr.txt into
the file /etc/group but again the ls-l command did nt show the changes
infact . Why??

The output of cat /etc/group command after running the script you had given:
[root@authdns etc]# cat
 group
..........
.............
s08-1-5-095:x:500:
s08-1-5-096:x:501:
s08-1-5-097:x:502:
[root@authdns etc]# 

And the output of the ls-l command is as below :-



-rw-r--r-- 1 root root   5124 2008-08-19 01:14 roll.txt
-rw-r--r-- 1 root root     37 2008-08-20 17:21 rr.txt
-rw-r--r-- 1 root root   5076 2008-08-19 20:22 r.txt
drwx------ 2 root root   4096 2008-08-20 18:44 s08-1-5-095
drwx------ 2 root root   4096 2008-08-20 18:44 s08-1-5-096
drwx------ 2 root root   4096 2008-08-20 18:44 s08-1-5-097

The output on running the script, 


Usage: groupadd [options] GROUP

Options:
  -f, --force                   force exit with success status if the
 specified
                                group already exists
  -r,                       create system account
  -g, --gid GID                 use GID for the new group
  -h, --help                    display this help message and exit
  -K, --key KEY=VALUE           overrides /etc/login.defs defaults
  -o, --non-unique              allow create group with
 duplicate
                                (non-unique) GID

However
on my cluster server, I did get any such type of messages displyed on
running the script but at the same time ls -l command did not show up
the owner and group as the rollno, but it showed up as "root" a both
owner and the group.

Also the /etc/group file was not updated. why any pointers ??



No, , that the /etc/group file was not being
updated with the rollnos, from the file rr.txt, on running the script on the clsuter server, why what was
was wrong.

It adds to the file /ect/group but it does shows up the owner and the group as root only.

What is wrong ??

The output is shown below :-


drwxr-xr-x  2 s07-1-5-060 s07-1-5-060 3864 Jan 25  2008 s07-1-5-060
drwxr-xr-x  2 s07-1-5-061 s07-1-5-061 3864 Jan 25  2008 s07-1-5-061
drwxr-xr-x  2 root        root        3864 Aug 20 19:05 s08-1-5-095
drwxr-xr-x  2 root        root        3864
 Aug 20 19:05 s08-1-5-096
drwxr-xr-x  2 root        root        3864 Aug 19 23:58 s08-1-5-097
-rw-r--r--  1 root        root         239 Aug 20 19:05 s.pl

The owner and group should be the rollno. 

ANY POINTERS ??
  

--- On Wed, 8/20/08, Andrej Ricnik-Bay <andrej.groups@gmail.com> wrote:
From: Andrej Ricnik-Bay <andrej.groups@gmail.com>
Subject: Re: Perl Script Needed To Create The Home Drectories.
To: "Marc Girod" <marc.girod@gmail.com>, "Perl-LDAP Mailing List" <perl-ldap@perl.org>
Date: Wednesday, August 20, 2008, 11:33 PM

On 20/08/2008, Marc Girod <marc.girod@gmail.com> wrote:

>  But, questions like 'why is there a @ on line 4?' should be
>  acceptable.
But you don't sign up for a power-sliding event and then
ask the people there what those pedals are for ... ?


>  Marc
Cheers,
Andrej


-- 
Please don't top post, and don't use HTML e-Mail :}  Make your quotes
concise.

http://www.american.edu/econ/notes/htmlmail.htm



      
Navigate in group perl.ldap at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants