For Programmers: Free Programming Magazines  


Home > Archive > PERL Programming > July 2004 > mkdir and chmod









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author mkdir and chmod
Ken Down

2004-06-27, 3:55 pm

I'm having a problem with these commands. First I create a subdirectory in
my webspace

mkdir $dirname 0777 or die "Can't make directory";

Then I write a file to it and set the permissions

close($outhandle);
chmod(0777,$outname);

When I examine the subdirectory and the file using my FTP program, both are
set to 0766 and, what is more, I cannot alter the permissions - or rather, I
go through the steps and the permissions remain unaltered. I can alter other
subdirectories and files within the same directory, but not the newly
created ones.

Any ideas what is going wrong?

Thanks,
Ken Down



--
__ __ __ __ __
| \ | / __ / __ | |\ | / __ |__ All the latest archaeological news
|__/ | \__/ \__/ | | \| \__/ __| from the Middle East with David Down
================================= and "Digging Up The Past"
Web site: www.diggingsonline.com
e-mail: diggings@argonet.co.uk


Gunnar Hjalmarsson

2004-06-27, 3:55 pm

Ken Down wrote:
> I'm having a problem with these commands. First I create a
> subdirectory in my webspace
>
> mkdir $dirname 0777 or die "Can't make directory";


Suppose you mean:

mkdir $dirname, 0777 or die "Can't make directory";
------------------^

(please copy and paste, don't retype)

> Then I write a file to it and set the permissions
>
> close($outhandle);
> chmod(0777,$outname);
>
> When I examine the subdirectory and the file using my FTP
> program, both are set to 0766 and,


Since you are using your FTP program to check it out, I get the
feeling that your program is running as a CGI script (in that case you
should have said so), and CGI is probably run as some other user but
yourself.

Maybe the server is configured to not allow 0777?

> what is more, I cannot alter the permissions - or rather, I
> go through the steps and the permissions remain unaltered.


That's probably because the script created directory and file are
owned by the user that CGI is run as, not by you.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Ken Down

2004-06-28, 4:07 pm

In article <2k8ilnF17ec4hU1@uni-berlin.de>, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:

> Suppose you mean:
> mkdir $dirname, 0777 or die "Can't make directory";


I do indeed - and I've just checked. The comma is in the script.

> Since you are using your FTP program to check it out, I get the
> feeling that your program is running as a CGI script (in that case you
> should have said so), and CGI is probably run as some other user but
> yourself.


Sorry. Yes, it is running as a CGI script.

> Maybe the server is configured to not allow 0777?


No, the fact that I can alter other directories to 0777 indicates that it is
possible.

> That's probably because the script created directory and file are
> owned by the user that CGI is run as, not by you.


Hmmmm. That's a thought. I'll check. Thanks.

Ken Down

--
__ __ __ __ __
| \ | / __ / __ | |\ | / __ |__ All the latest archaeological news
|__/ | \__/ \__/ | | \| \__/ __| from the Middle East with David Down
================================= and "Digging Up The Past"
Web site: www.diggingsonline.com
e-mail: diggings@argonet.co.uk


Ken Down

2004-06-29, 3:57 pm

In article <na.abfe504cc5.a60290diggings@argonet.co.uk>, Ken Down
<diggings@argonet.co.uk> wrote:

[color=darkred]
> Hmmmm. That's a thought. I'll check. Thanks.


Just to carry on talking to myself, I phoned up the company that hosts my
site and the guy promised to look into the problem. He phoned back a quarter
of an hour later to say that he, too, couldn't get it to work and was
passing the problem on to an expert in Perl.

I'll keep myself (and you) posted.

Ken Down

--
__ __ __ __ __
| \ | / __ / __ | |\ | / __ |__ All the latest archaeological news
|__/ | \__/ \__/ | | \| \__/ __| from the Middle East with David Down
================================= and "Digging Up The Past"
Web site: www.diggingsonline.com
e-mail: diggings@argonet.co.uk


Tintin

2004-06-30, 3:57 am


"Ken Down" <diggings@argonet.co.uk> wrote in message
news:na.b2840a4cc6.a60290diggings@argonet.co.uk...
> In article <na.abfe504cc5.a60290diggings@argonet.co.uk>, Ken Down
> <diggings@argonet.co.uk> wrote:
>
>
>
> Just to carry on talking to myself, I phoned up the company that hosts my
> site and the guy promised to look into the problem. He phoned back a

quarter
> of an hour later to say that he, too, couldn't get it to work and was
> passing the problem on to an expert in Perl.
>
> I'll keep myself (and you) posted.


It's not a Perl problem. It would happen with whatever language you decided
to use.

It's a simple matter of Unix ownerships/permissions.


Ken Down

2004-07-01, 3:55 am

In article <2kf8g8F1kh3pU1@uni-berlin.de>, "Tintin" <me@privacy.net> wrote:

> It's a simple matter of Unix ownerships/permissions.


Is there any way of reassigning ownerships?

Ken Down

--
__ __ __ __ __
| \ | / __ / __ | |\ | / __ |__ All the latest archaeological news
|__/ | \__/ \__/ | | \| \__/ __| from the Middle East with David Down
================================= and "Digging Up The Past"
Web site: www.diggingsonline.com
e-mail: diggings@argonet.co.uk


d0x

2004-07-01, 8:55 am

MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Complaints-To: abuse@supernews.com
Lines: 13
Xref: number1.nntp.dca.giganews.com alt.perl:36302

On Wed, 30 Jun 2004 20:46:02 +0000, Ken Down wrote:

> In article <2kf8g8F1kh3pU1@uni-berlin.de>, "Tintin" <me@privacy.net>
> wrote:
>
>
> Is there any way of reassigning ownerships?
>
> Ken Down



chown, but only root can run it.
Ken Down

2004-07-02, 3:55 am

In article <pan.2004.07.01.09.25.42.731959@no.spam>, d0x <dan@no.spam>
wrote:

> chown, but only root can run it.


And I would probably have to chgrp as well.

Bah.

Ken Down

--
__ __ __ __ __
| \ | / __ / __ | |\ | / __ |__ All the latest archaeological news
|__/ | \__/ \__/ | | \| \__/ __| from the Middle East with David Down
================================= and "Digging Up The Past"
Web site: www.diggingsonline.com
e-mail: diggings@argonet.co.uk


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com