how to add the user to one unix group using perl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ritusriv
    New Member
    • Jul 2008
    • 7

    #1

    how to add the user to one unix group using perl

    Hi

    I just wanted to know is there any way in the perl to add a unix user to unix group.
    e.g.
    I linux we have command to do so,
    Code:
    usermod -a -G <group> <user>
    I have found a CPAN perl module Linux:usermod to do so,Is there any other way except this module ?

    Regards,
    Ritusriv
  • nithinpes
    Recognized Expert Contributor
    • Dec 2007
    • 410

    #2
    Alternatively, you can make use of system() command or backticks in Perl, to execute the same linux command.

    Comment

    • Ritusriv
      New Member
      • Jul 2008
      • 7

      #3
      Originally posted by nithinpes
      Alternatively, you can make use of system() command or backticks in Perl, to execute the same linux command.
      Thats true but I just wanted to confirm that Is there any way in Perl to do so..

      Comment

      • nithinpes
        Recognized Expert Contributor
        • Dec 2007
        • 410

        #4
        Originally posted by Ritusriv
        Thats true but I just wanted to confirm that Is there any way in Perl to do so..
        There is no straight forward method of doing it in Perl, as far as I know. You have to make use of certain modules. Other than the one you mentioned, you can have a look at Unix::GroupFile module.

        - Nithin

        Comment

        Working...