LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-12-2009, 03:29 AM   #1
ak4good
LQ Newbie
 
Registered: Jun 2009
Posts: 1

Rep: Reputation: 0
Post Insecure dependency in chmod while running setuid


Hello,

Total beginner here. I need a cgi script to run as root to recursively change file permissions. I slapped something together from examples, but Apache complains:

Quote:
Insecure dependency in chmod while running setuid at /var/www/cgi-bin/set-perms.pl line 13., referer: https://example.com/cgi-bin/
This is the script:

Code:
#!/usr/bin/perl -wT

BEGIN {
  $ENV{PATH} = "";
}

use strict;
use File::Find;
$|++;

my $baseDir  = "/var/www/test/";
my $modeFile = oct(664);
my $modeDir  = oct(2775);

sub setperms {
  chmod($modeFile, $_) if(-f $_);  <------/line 13/
  chmod($modeDir, $_)  if(-d $_);
  chown(-1, 1005, $_);
}

find(\&setperms, "$baseDir");
Please help...
 
Old 06-12-2009, 06:50 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Instead of using kludges please check if your problem can be fixed with ACLs (http://acl.bestbits.at).
 
Old 06-12-2009, 11:35 PM   #3
akelder
Member
 
Registered: Jan 2007
Distribution: debian on servers, ubuntu on desktops/laptops
Posts: 45

Rep: Reputation: 16
The problem is that when Mac users mount a file system on our Linux server locally via MacFUSE, the permissions for new files/dirs they create follow their local umask settings and ignore the directory sticky bit set on the Linux server.

Wouldn't we have the same problem if we used ACLs on the Linux box? Wouldn't files user create over MacFUSE mounts come with their local ACL attributes like they come with their local Unix permissions?

I don't like the idea of running cgi scripts as root any more than the next guy, so I finally gave up on the idea and gave these users sudo rights to run a permission fixing script.
 
Old 06-13-2009, 10:22 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by akelder View Post
Wouldn't we have the same problem if we used ACLs on the Linux box? Wouldn't files user create over MacFUSE mounts come with their local ACL attributes like they come with their local Unix permissions?
I don't know but given the ease with which you can test such stuff I'd say try and let us know.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache: difference between chmod 644 and chmod 666 and chmod 600 for output/txt/dat? frenchn00b Programming 6 04-22-2009 01:10 PM
chmod / setuid akuma_linux Linux - Newbie 4 10-23-2007 08:52 AM
chmod 775 to only the directories and chmod 664 to only the files? apachenew Linux - Security 6 09-27-2007 03:26 PM
chmod, external usb, vfat - can't chmod a directory itsjustme Slackware 2 04-02-2006 04:23 PM
Insecure dependency errror(perl-cgi) akaash Programming 1 04-02-2004 10:17 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration