[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cobalt-users] [RaQ3] Using chown in Perl scripts
- Subject: [cobalt-users] [RaQ3] Using chown in Perl scripts
- From: "Robert Fitzpatrick" <robert@xxxxxxxxxxx>
- Date: Sun Jan 20 16:32:01 2002
- List-id: Mailing list for users to share thoughts on Cobalt products. <cobalt-users.list.cobalt.com>
Well, I have Procmail and Spam Bouncer all setup and working great :)
And tweaked very nicely I must say for the Cobalt way. However, now I
am trying to write a Perl script as an add-on to the Neomail web-based
e-mail scripts our users use that allows them to turn the filtering on
and set various options for Procmail/Spam Bouncer. I am having one
problem, in the script after it creates the appropriate directory for
the .procmailrc and .forward files, it then attempts to set the
appropriate permissions and ownership necessary for Procmail to work.
This is not working :(
Once the script creates the directory, filter, and places the files in
that directory, I am executing the following in the Perl script:
mkdir ("$homedir/filter", 0744);
chown ($login, $gid, '$homedir/filter');
chmod (0600, '$homedir/filter/.forward');
chown ($login, $gid, '$homedir/filter/.forward');
chmod (0600, '$homedir/filter/.procmailrc');
chown ($login, $gid, '$homedir/filter/.procmailrc');
This is what I get:
drwxr----- 2 root site# 1024 Jan 20 18:51 filter
-rw-rw---- 1 root site# 20 Jan 20 18:51 .forward
-rw-rw---- 1 root site# 2788 Jan 20 18:51 .procmailrc
As you can see, the permissions nor the ownership are not being set as
requested. I have tried everying all day, searching for solutions on
this and other lists as well as Perl docs. I tried using the 'system
()' function, altering the order in which it is performed, etc.
Everything I read regarding Perl tell me that this should work. I am
now asking to see if it is a Cobalt thing, can anyone tell me if they
are successfully chowning files in using Perl scripts? If so, how?
I also tried this simple script (via ssh):
#!/usr/bin/perl
$user = "admin";
$group = "admin";
$dir = "/home/software/scripts";
chmod (0744,$dir);
chown ($user,$group,$dir);
print "Done.\n";
This is attempting to do the same thing on the 'scripts' directory,
which it and it's parent are owned by 'admin' before executing and I'm
logged in as root. This is what I get (permissions look good, but the
ownership is the problem):
drwxr--r-- 2 root root 1024 Jan 20 14:50 scripts
But if I type "chown admin.admin /home/software/scripts, it works fine
setting the ownership to admin for the user and group.
Any help is GREATLY appreciated!
--
Robert