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
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>