suidperl.

From: Rod Za (rodzadra_at_yahoo.com)
Date: 03/25/05

  • Next message: Bob Nix: "Question on configuring Help"
    Date: Fri, 25 Mar 2005 11:52:06 -0800 (PST)
    To: beginners@perl.org
    
    

    Hello all.

    I'm trying to make changes in a file (smb.conf) that is owner by root (chmod=644). I'm using the
    Config::IniFiles module to do the work and the script run as 'lp' user.

    This is a piece of code:
    <code>
    if($self->{config}{AUTO_SMB_PRINTER}){
     $self->log_it('DEBUG',"(D): Auto SAMBA printer on.");
     my $smb_cfg = new Config::IniFiles( -file => '/etc/samba/smb.conf');
     if (!$smb_cfg){
        $self->log_it('DEBUG',"(D) Error on open '/etc/samba/smb.conf'");
        $self->log_it('DEBUG',Dumper(@Config::IniFiles::errors));
     }
     if(!$smb_cfg->SectionExists("$self->{printer}")){
        $smb_cfg->AddSection($self->{printer});
        $smb_cfg->newval($self->{printer},'comment','Auto printer');
        $smb_cfg->newval($self->{printer},'path','/var/tmp');
        $smb_cfg->newval($self->{printer},'printable','yes');
        $smb_cfg->newval($self->{printer},'browseable','yes');
        $smb_cfg->newval($self->{printer},'guest ok','yes');
        $smb_cfg->newval($self->{printer},'public','yes');
        if($smb_cfg->WriteConfig('/etc/samba/smb.conf')){
             $self->log_it('DEBUG',"(D): - Auto SAMBA printer OK.");
        } else {
             $self->log_it('ERR',"(E): - Error on Auto SAMBA printer: $!");
        }
     } else {
       $self->log_it('DEBUG',"The printer exists.");
     }
    } else {
      $self->log_it('DEBUG',"Auto SAMBA printer off.");
    }
    </code>

    This doesnt works becouse the owner of the file is 'root'. How can i solve this? using suidperl?

    thank you very much

    Rodrigo

    __________________________________________________
    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com


  • Next message: Bob Nix: "Question on configuring Help"

    Relevant Pages

    • Re: how to change roots shell
      ... Im going to see if I can walk a user at the site through single user mode. ... su to root or even login as root. ... Do You Yahoo!? ... Mail has the best spam protection around ...
      (freebsd-questions)
    • Re: arts/ALSA problem after unstable upgrade (solved)
      ... ...as root; ... Do You Yahoo!? ... Mail has the best spam protection around ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
      (Debian-User)
    • Re: Runlevel3 services
      ... when i su to root... ... press serv and tab and all i get is servertool and ... Do You Yahoo!? ... Mail has the best spam protection around ...
      (Fedora)
    • Re: Newbie cannot start graphical desktop
      ... > You are trying to use X programs as root? ... with Knoppix and my monitor now perfectly configured. ... Do You Yahoo!? ... Mail has the best spam protection around ...
      (Debian-User)
    • Re: Stopping a Service with cgi
      ... Your script will run with full root privileges. ... Some systems don't support secure set-id scripts, ... Do You Yahoo!? ... Mail has the best spam protection around ...
      (perl.beginners)