Chmod

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • frizzle

    #1

    Chmod

    Hi,

    I am at the base of an FTP thingy i'm building, and i noticed that
    it would only work if i chmod the folder 777, i thought to remember
    correctly that previously on another site chmod 744 was enough,
    now it isn't.
    Am i mistaking, and should it always be 777 ? And isn't a chmodded
    777 folder much more vulnerable?

    Frizzle.


    Code sofar below:


    +++++++++++++++ +++++++++++
    <?php

    require_once('. ./inc/globals.php');

    if( isset( $_FILES['image'] ) ){

    $ftp_conn = @ftp_connect( $default_ftp_se rver )or
    die('<b>Error!</b>');
    @ftp_login( $ftp_conn, $default_ftp_us er, $default_ftp_pa ss )or
    die('<bError!</b>');

    $uploaddir = '../items/';
    $uploadfile = $uploaddir . basename( $_FILES['image']['name'] );

    if ( move_uploaded_f ile( $_FILES['image']['tmp_name'], $uploadfile ) ){
    echo "File is valid, and was successfully uploaded.";
    } else {
    echo "Possible file upload attack!";
    };

    ftp_close( $ftp_conn );

    };

    ?>
    <form action="<?php echo $PHP_SELF; ?>" method="post"
    enctype="multip art/form-data" name="images" target="_top" id="images"
    class="form">
    <input name="image" type="file" id="image">
    <br>
    <input type="submit" name="upload" id="upload" value="Upload">
    <input name="cancel" type="button" id="cancel" value="Cancel"
    onClick="javasc ript:history.go (-1) ">
    </form><?php

    if (is_dir($upload dir)) {
    if ($dh = opendir($upload dir)) {
    while (($file = readdir($dh)) !== false) {
    if ($file !== '..' && $file !== '.') echo "filename: $file :
    filetype: " . filetype($uploa ddir . $file) . "<br>\r\n";
    }
    closedir($dh);
    }
    };

    ?>
    ----------------------------------------------------

  • frizzle

    #2
    Re: Chmod


    Gary L. Burnore wrote:[color=blue]
    > On 4 Apr 2006 15:10:39 -0700, "frizzle" <phpfrizzle@gma il.com> wrote:
    >[color=green]
    > >Hi,
    > >
    > >I am at the base of an FTP thingy i'm building, and i noticed that
    > >it would only work if i chmod the folder 777, i thought to remember
    > >correctly that previously on another site chmod 744 was enough,
    > >now it isn't.
    > >Am i mistaking, and should it always be 777 ? And isn't a chmodded
    > >777 folder much more vulnerable?[/color]
    >
    >
    > Most definitely more vulnerable.
    >
    >
    > You want 755, not 744. You need the x bit set. It should look like
    > this:
    >
    > drwxr-xr-x ... ...
    >
    >
    > The x on a directory means search, not execute. If you can't search
    > the directory, you can't read the files in it.
    >
    > If you want people to be able to find the files but not list the
    > directory when they're on the server, you can set the directory as 711
    > which would look like:
    >
    > drwx--x--x ... ...
    >
    >
    >[color=green]
    > >Frizzle.
    > >
    > >
    > >Code sofar below:
    > >
    > >
    > >++++++++++++++ ++++++++++++
    > ><?php
    > >
    > > require_once('. ./inc/globals.php');
    > >
    > > if( isset( $_FILES['image'] ) ){
    > >
    > >$ftp_conn = @ftp_connect( $default_ftp_se rver )or
    > >die('<b>Error! </b>');
    > >@ftp_login( $ftp_conn, $default_ftp_us er, $default_ftp_pa ss )or
    > >die('<bError !</b>');
    > >
    > >$uploaddir = '../items/';
    > >$uploadfile = $uploaddir . basename( $_FILES['image']['name'] );
    > >
    > >if ( move_uploaded_f ile( $_FILES['image']['tmp_name'], $uploadfile ) ){
    > > echo "File is valid, and was successfully uploaded.";
    > >} else {
    > > echo "Possible file upload attack!";
    > >};
    > >
    > >ftp_close( $ftp_conn );
    > >
    > >};
    > >
    > >?>
    > ><form action="<?php echo $PHP_SELF; ?>" method="post"
    > >enctype="multi part/form-data" name="images" target="_top" id="images"
    > >class="form" >
    > > <input name="image" type="file" id="image">
    > > <br>
    > > <input type="submit" name="upload" id="upload" value="Upload">
    > > <input name="cancel" type="button" id="cancel" value="Cancel"
    > >onClick="javas cript:history.g o(-1) ">
    > ></form><?php
    > >
    > > if (is_dir($upload dir)) {
    > > if ($dh = opendir($upload dir)) {
    > > while (($file = readdir($dh)) !== false) {
    > > if ($file !== '..' && $file !== '.') echo "filename: $file:
    > >filetype: " . filetype($uploa ddir . $file) . "<br>\r\n";
    > > }
    > > closedir($dh);
    > > }
    > > };
    > >
    > >?>
    > >----------------------------------------------------[/color]
    > --
    > gburnore at DataBasix dot Com
    > ---------------------------------------------------------------------------
    > How you look depends on where you go.
    > ---------------------------------------------------------------------------
    > Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
    > | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
    > Official .sig, Accept no substitutes. | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
    > | ÝÛ 0 1 7 2 3 / Ý³Þ 3 74 9 3 0 Û³
    > Black Helicopter Repair Services, Ltd.| Official Proof of Purchase
    > =============== =============== =============== =============== ===============[/color]

    Hmm, i still get an error; i chmodded both the destination folder AND
    the executing script-file 755.

    Warning: move_uploaded_f ile(../items/bg.jpg): failed to open stream:
    Permission denied in
    /home/httpd/vhosts/domain.com/httpdocs/new/admin/ftptest.php on line 15

    Read mode Write mode Execute/search mode
    Owner + + +
    Group + - +
    Others + - +

    Frizzle.

    Comment

    • bobzimuta

      #3
      Re: Chmod

      Are you allowing your web server write permissions to the folder?
      Assuming the webserver runs as 'nobody' .
      755 with ownership nobody, nobody . Otherwise you'll need
      775 with ownership frizzle, nobody


      frizzle wrote:[color=blue]
      > Gary L. Burnore wrote:[color=green]
      > > On 4 Apr 2006 15:10:39 -0700, "frizzle" <phpfrizzle@gma il.com> wrote:
      > >[color=darkred]
      > > >Hi,
      > > >
      > > >I am at the base of an FTP thingy i'm building, and i noticed that
      > > >it would only work if i chmod the folder 777, i thought to remember
      > > >correctly that previously on another site chmod 744 was enough,
      > > >now it isn't.
      > > >Am i mistaking, and should it always be 777 ? And isn't a chmodded
      > > >777 folder much more vulnerable?[/color]
      > >
      > >
      > > Most definitely more vulnerable.
      > >
      > >
      > > You want 755, not 744. You need the x bit set. It should look like
      > > this:
      > >
      > > drwxr-xr-x ... ...
      > >
      > >
      > > The x on a directory means search, not execute. If you can't search
      > > the directory, you can't read the files in it.
      > >
      > > If you want people to be able to find the files but not list the
      > > directory when they're on the server, you can set the directory as 711
      > > which would look like:
      > >
      > > drwx--x--x ... ...
      > >
      > >
      > >[color=darkred]
      > > >Frizzle.
      > > >
      > > >
      > > >Code sofar below:
      > > >
      > > >
      > > >++++++++++++++ ++++++++++++
      > > ><?php
      > > >
      > > > require_once('. ./inc/globals.php');
      > > >
      > > > if( isset( $_FILES['image'] ) ){
      > > >
      > > >$ftp_conn = @ftp_connect( $default_ftp_se rver )or
      > > >die('<b>Error! </b>');
      > > >@ftp_login( $ftp_conn, $default_ftp_us er, $default_ftp_pa ss )or
      > > >die('<bError !</b>');
      > > >
      > > >$uploaddir = '../items/';
      > > >$uploadfile = $uploaddir . basename( $_FILES['image']['name'] );
      > > >
      > > >if ( move_uploaded_f ile( $_FILES['image']['tmp_name'], $uploadfile ) ){
      > > > echo "File is valid, and was successfully uploaded.";
      > > >} else {
      > > > echo "Possible file upload attack!";
      > > >};
      > > >
      > > >ftp_close( $ftp_conn );
      > > >
      > > >};
      > > >
      > > >?>
      > > ><form action="<?php echo $PHP_SELF; ?>" method="post"
      > > >enctype="multi part/form-data" name="images" target="_top" id="images"
      > > >class="form" >
      > > > <input name="image" type="file" id="image">
      > > > <br>
      > > > <input type="submit" name="upload" id="upload" value="Upload">
      > > > <input name="cancel" type="button" id="cancel" value="Cancel"
      > > >onClick="javas cript:history.g o(-1) ">
      > > ></form><?php
      > > >
      > > > if (is_dir($upload dir)) {
      > > > if ($dh = opendir($upload dir)) {
      > > > while (($file = readdir($dh)) !== false) {
      > > > if ($file !== '..' && $file !== '.') echo "filename: $file :
      > > >filetype: " . filetype($uploa ddir . $file) . "<br>\r\n";
      > > > }
      > > > closedir($dh);
      > > > }
      > > > };
      > > >
      > > >?>
      > > >----------------------------------------------------[/color]
      > > --
      > > gburnore at DataBasix dot Com
      > > ---------------------------------------------------------------------------
      > > How you look depends on where you go.
      > > ---------------------------------------------------------------------------
      > > Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
      > > | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
      > > Official .sig, Accept no substitutes. | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
      > > | ÝÛ 0 1 7 2 3 / Ý³Þ 37 4 9 3 0 Û³
      > > Black Helicopter Repair Services, Ltd.| Official Proof of Purchase
      > > =============== =============== =============== =============== ===============[/color]
      >
      > Hmm, i still get an error; i chmodded both the destination folder AND
      > the executing script-file 755.
      >
      > Warning: move_uploaded_f ile(../items/bg.jpg): failed to open stream:
      > Permission denied in
      > /home/httpd/vhosts/domain.com/httpdocs/new/admin/ftptest.php on line 15
      >
      > Read mode Write mode Execute/search mode
      > Owner + + +
      > Group + - +
      > Others + - +
      >
      > Frizzle.[/color]

      Comment

      • frizzle

        #4
        Re: Chmod


        bobzimuta wrote:[color=blue]
        > Are you allowing your web server write permissions to the folder?
        > Assuming the webserver runs as 'nobody' .
        > 755 with ownership nobody, nobody . Otherwise you'll need
        > 775 with ownership frizzle, nobody
        >
        >
        > frizzle wrote:[color=green]
        > > Gary L. Burnore wrote:[color=darkred]
        > > > On 4 Apr 2006 15:10:39 -0700, "frizzle" <phpfrizzle@gma il.com> wrote:
        > > >
        > > > >Hi,
        > > > >
        > > > >I am at the base of an FTP thingy i'm building, and i noticed that
        > > > >it would only work if i chmod the folder 777, i thought to remember
        > > > >correctly that previously on another site chmod 744 was enough,
        > > > >now it isn't.
        > > > >Am i mistaking, and should it always be 777 ? And isn't a chmodded
        > > > >777 folder much more vulnerable?
        > > >
        > > >
        > > > Most definitely more vulnerable.
        > > >
        > > >
        > > > You want 755, not 744. You need the x bit set. It should look like
        > > > this:
        > > >
        > > > drwxr-xr-x ... ...
        > > >
        > > >
        > > > The x on a directory means search, not execute. If you can't search
        > > > the directory, you can't read the files in it.
        > > >
        > > > If you want people to be able to find the files but not list the
        > > > directory when they're on the server, you can set the directory as 711
        > > > which would look like:
        > > >
        > > > drwx--x--x ... ...
        > > >
        > > >
        > > >
        > > > >Frizzle.
        > > > >
        > > > >
        > > > >Code sofar below:
        > > > >
        > > > >
        > > > >++++++++++++++ ++++++++++++
        > > > ><?php
        > > > >
        > > > > require_once('. ./inc/globals.php');
        > > > >
        > > > > if( isset( $_FILES['image'] ) ){
        > > > >
        > > > >$ftp_conn = @ftp_connect( $default_ftp_se rver )or
        > > > >die('<b>Error! </b>');
        > > > >@ftp_login( $ftp_conn, $default_ftp_us er, $default_ftp_pa ss )or
        > > > >die('<bError !</b>');
        > > > >
        > > > >$uploaddir = '../items/';
        > > > >$uploadfile = $uploaddir . basename( $_FILES['image']['name'] );
        > > > >
        > > > >if ( move_uploaded_f ile( $_FILES['image']['tmp_name'], $uploadfile )){
        > > > > echo "File is valid, and was successfully uploaded.";
        > > > >} else {
        > > > > echo "Possible file upload attack!";
        > > > >};
        > > > >
        > > > >ftp_close( $ftp_conn );
        > > > >
        > > > >};
        > > > >
        > > > >?>
        > > > ><form action="<?php echo $PHP_SELF; ?>" method="post"
        > > > >enctype="multi part/form-data" name="images" target="_top" id="images"
        > > > >class="form" >
        > > > > <input name="image" type="file" id="image">
        > > > > <br>
        > > > > <input type="submit" name="upload" id="upload" value="Upload">
        > > > > <input name="cancel" type="button" id="cancel" value="Cancel"
        > > > >onClick="javas cript:history.g o(-1) ">
        > > > ></form><?php
        > > > >
        > > > > if (is_dir($upload dir)) {
        > > > > if ($dh = opendir($upload dir)) {
        > > > > while (($file = readdir($dh)) !== false) {
        > > > > if ($file !== '..' && $file !== '.') echo "filename: $file :
        > > > >filetype: " . filetype($uploa ddir . $file) . "<br>\r\n";
        > > > > }
        > > > > closedir($dh);
        > > > > }
        > > > > };
        > > > >
        > > > >?>
        > > > >----------------------------------------------------
        > > > --
        > > > gburnore at DataBasix dot Com
        > > > ---------------------------------------------------------------------------
        > > > How you look depends on where you go.
        > > > ---------------------------------------------------------------------------
        > > > Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
        > > > | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
        > > > Official .sig, Accept no substitutes. | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
        > > > | ÝÛ 0 1 7 2 3 / ݳÞ3 7 4 9 3 0 Û³
        > > > Black Helicopter Repair Services, Ltd.| Official Proof of Purchase
        > > > =============== =============== =============== =============== ===============[/color]
        > >
        > > Hmm, i still get an error; i chmodded both the destination folder AND
        > > the executing script-file 755.
        > >
        > > Warning: move_uploaded_f ile(../items/bg.jpg): failed to open stream:
        > > Permission denied in
        > > /home/httpd/vhosts/domain.com/httpdocs/new/admin/ftptest.php on line 15
        > >
        > > Read mode Write mode Execute/search mode
        > > Owner + + +
        > > Group + - +
        > > Others + - +
        > >
        > > Frizzle.[/color][/color]

        Standard (DW created files/dirs) have user 'domainname', permissions
        'rwx r-x r-x ',
        Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
        --- --- '

        Frizzle.

        Comment

        • frizzle

          #5
          Re: Chmod


          frizzle wrote:[color=blue]
          > bobzimuta wrote:[color=green]
          > > Are you allowing your web server write permissions to the folder?
          > > Assuming the webserver runs as 'nobody' .
          > > 755 with ownership nobody, nobody . Otherwise you'll need
          > > 775 with ownership frizzle, nobody
          > >
          > >
          > > frizzle wrote:[color=darkred]
          > > > Gary L. Burnore wrote:
          > > > > On 4 Apr 2006 15:10:39 -0700, "frizzle" <phpfrizzle@gma il.com> wrote:
          > > > >
          > > > > >Hi,
          > > > > >
          > > > > >I am at the base of an FTP thingy i'm building, and i noticed that
          > > > > >it would only work if i chmod the folder 777, i thought to remember
          > > > > >correctly that previously on another site chmod 744 was enough,
          > > > > >now it isn't.
          > > > > >Am i mistaking, and should it always be 777 ? And isn't a chmodded
          > > > > >777 folder much more vulnerable?
          > > > >
          > > > >
          > > > > Most definitely more vulnerable.
          > > > >
          > > > >
          > > > > You want 755, not 744. You need the x bit set. It should look like
          > > > > this:
          > > > >
          > > > > drwxr-xr-x ... ...
          > > > >
          > > > >
          > > > > The x on a directory means search, not execute. If you can't search
          > > > > the directory, you can't read the files in it.
          > > > >
          > > > > If you want people to be able to find the files but not list the
          > > > > directory when they're on the server, you can set the directory as 711
          > > > > which would look like:
          > > > >
          > > > > drwx--x--x ... ...
          > > > >
          > > > >
          > > > >
          > > > > >Frizzle.
          > > > > >
          > > > > >
          > > > > >Code sofar below:
          > > > > >
          > > > > >
          > > > > >++++++++++++++ ++++++++++++
          > > > > ><?php
          > > > > >
          > > > > > require_once('. ./inc/globals.php');
          > > > > >
          > > > > > if( isset( $_FILES['image'] ) ){
          > > > > >
          > > > > >$ftp_conn = @ftp_connect( $default_ftp_se rver )or
          > > > > >die('<b>Error! </b>');
          > > > > >@ftp_login( $ftp_conn, $default_ftp_us er, $default_ftp_pa ss )or
          > > > > >die('<bError !</b>');
          > > > > >
          > > > > >$uploaddir = '../items/';
          > > > > >$uploadfile = $uploaddir . basename( $_FILES['image']['name'] );
          > > > > >
          > > > > >if ( move_uploaded_f ile( $_FILES['image']['tmp_name'], $uploadfile) ){
          > > > > > echo "File is valid, and was successfully uploaded.";
          > > > > >} else {
          > > > > > echo "Possible file upload attack!";
          > > > > >};
          > > > > >
          > > > > >ftp_close( $ftp_conn );
          > > > > >
          > > > > >};
          > > > > >
          > > > > >?>
          > > > > ><form action="<?php echo $PHP_SELF; ?>" method="post"
          > > > > >enctype="multi part/form-data" name="images" target="_top" id="images"
          > > > > >class="form" >
          > > > > > <input name="image" type="file" id="image">
          > > > > > <br>
          > > > > > <input type="submit" name="upload" id="upload" value="Upload">
          > > > > > <input name="cancel" type="button" id="cancel" value="Cancel"
          > > > > >onClick="javas cript:history.g o(-1) ">
          > > > > ></form><?php
          > > > > >
          > > > > > if (is_dir($upload dir)) {
          > > > > > if ($dh = opendir($upload dir)) {
          > > > > > while (($file = readdir($dh)) !== false) {
          > > > > > if ($file !== '..' && $file !== '.') echo "filename:$ file :
          > > > > >filetype: " . filetype($uploa ddir . $file) . "<br>\r\n";
          > > > > > }
          > > > > > closedir($dh);
          > > > > > }
          > > > > > };
          > > > > >
          > > > > >?>
          > > > > >----------------------------------------------------
          > > > > --
          > > > > gburnore at DataBasix dot Com
          > > > > ---------------------------------------------------------------------------
          > > > > How you look depends on where you go.
          > > > > ---------------------------------------------------------------------------
          > > > > Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
          > > > > | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
          > > > > Official .sig, Accept no substitutes. | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
          > > > > | ÝÛ 0 1 7 2 3 / Ý³Þ 3 7 4 9 3 0 Û³
          > > > > Black Helicopter Repair Services, Ltd.| Official Proof of Purchase
          > > > > =============== =============== =============== =============== ===============
          > > >
          > > > Hmm, i still get an error; i chmodded both the destination folder AND
          > > > the executing script-file 755.
          > > >
          > > > Warning: move_uploaded_f ile(../items/bg.jpg): failed to open stream:
          > > > Permission denied in
          > > > /home/httpd/vhosts/domain.com/httpdocs/new/admin/ftptest.php on line 15
          > > >
          > > > Read mode Write mode Execute/search mode
          > > > Owner + + +
          > > > Group + - +
          > > > Others + - +
          > > >
          > > > Frizzle.[/color][/color]
          >
          > Standard (DW created files/dirs) have user 'domainname', permissions
          > 'rwx r-x r-x ',
          > Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
          > --- --- '
          >
          > Frizzle.[/color]

          Is there a possibility to upload files via PHP without Chmodding, and
          keep the same group / permissions on uploaded files as those uploaded
          with, say, DreamWeaver or WS_FTP ?

          Frizzle.

          (E.g. with ftp_put() wich i can't seem to get working.)

          Comment

          • Chris H

            #6
            Re: Chmod

            I have a semi related chmod question that i think i know the answer too
            alredy but just want to be sure...

            Is it possible using PHP to set the permissions on a folder created from
            within a php application...


            "frizzle" <phpfrizzle@gma il.com> wrote in message
            news:1144188639 .518016.114480@ i39g2000cwa.goo glegroups.com.. .[color=blue]
            > Hi,
            >
            > I am at the base of an FTP thingy i'm building, and i noticed that
            > it would only work if i chmod the folder 777, i thought to remember
            > correctly that previously on another site chmod 744 was enough,
            > now it isn't.
            > Am i mistaking, and should it always be 777 ? And isn't a chmodded
            > 777 folder much more vulnerable?
            >
            > Frizzle.
            >
            >
            > Code sofar below:
            >
            >
            > +++++++++++++++ +++++++++++
            > <?php
            >
            > require_once('. ./inc/globals.php');
            >
            > if( isset( $_FILES['image'] ) ){
            >
            > $ftp_conn = @ftp_connect( $default_ftp_se rver )or
            > die('<b>Error!</b>');
            > @ftp_login( $ftp_conn, $default_ftp_us er, $default_ftp_pa ss )or
            > die('<bError!</b>');
            >
            > $uploaddir = '../items/';
            > $uploadfile = $uploaddir . basename( $_FILES['image']['name'] );
            >
            > if ( move_uploaded_f ile( $_FILES['image']['tmp_name'], $uploadfile ) ){
            > echo "File is valid, and was successfully uploaded.";
            > } else {
            > echo "Possible file upload attack!";
            > };
            >
            > ftp_close( $ftp_conn );
            >
            > };
            >
            > ?>
            > <form action="<?php echo $PHP_SELF; ?>" method="post"
            > enctype="multip art/form-data" name="images" target="_top" id="images"
            > class="form">
            > <input name="image" type="file" id="image">
            > <br>
            > <input type="submit" name="upload" id="upload" value="Upload">
            > <input name="cancel" type="button" id="cancel" value="Cancel"
            > onClick="javasc ript:history.go (-1) ">
            > </form><?php
            >
            > if (is_dir($upload dir)) {
            > if ($dh = opendir($upload dir)) {
            > while (($file = readdir($dh)) !== false) {
            > if ($file !== '..' && $file !== '.') echo "filename: $file :
            > filetype: " . filetype($uploa ddir . $file) . "<br>\r\n";
            > }
            > closedir($dh);
            > }
            > };
            >
            > ?>
            > ----------------------------------------------------
            >[/color]


            Comment

            • Jerry Stuckle

              #7
              Re: Chmod

              frizzle wrote:[color=blue]
              > frizzle wrote:
              >[color=green]
              >>bobzimuta wrote:
              >>[color=darkred]
              >>>Are you allowing your web server write permissions to the folder?
              >>>Assuming the webserver runs as 'nobody' .
              >>>755 with ownership nobody, nobody . Otherwise you'll need
              >>>775 with ownership frizzle, nobody
              >>>
              >>>
              >>>frizzle wrote:
              >>>
              >>>>Gary L. Burnore wrote:
              >>>>
              >>>>>On 4 Apr 2006 15:10:39 -0700, "frizzle" <phpfrizzle@gma il.com> wrote:
              >>>>>
              >>>>>
              >>>>>>Hi,
              >>>>>>
              >>>>>>I am at the base of an FTP thingy i'm building, and i noticed that
              >>>>>>it would only work if i chmod the folder 777, i thought to remember
              >>>>>>correct ly that previously on another site chmod 744 was enough,
              >>>>>>now it isn't.
              >>>>>>Am i mistaking, and should it always be 777 ? And isn't a chmodded
              >>>>>>777 folder much more vulnerable?
              >>>>>
              >>>>>
              >>>>>Most definitely more vulnerable.
              >>>>>
              >>>>>
              >>>>>You want 755, not 744. You need the x bit set. It should look like
              >>>>>this:
              >>>>>
              >>>>>drwxr-xr-x ... ...
              >>>>>
              >>>>>
              >>>>>The x on a directory means search, not execute. If you can't search
              >>>>>the directory, you can't read the files in it.
              >>>>>
              >>>>>If you want people to be able to find the files but not list the
              >>>>>director y when they're on the server, you can set the directory as 711
              >>>>>which would look like:
              >>>>>
              >>>>>drwx--x--x ... ...
              >>>>>
              >>>>>
              >>>>>
              >>>>>
              >>>>>>Frizzle .
              >>>>>>
              >>>>>>
              >>>>>>Code sofar below:
              >>>>>>
              >>>>>>
              >>>>>>+++++++++ +++++++++++++++ ++
              >>>>>><?php
              >>>>>>
              >>>>>> require_once('. ./inc/globals.php');
              >>>>>>
              >>>>>> if( isset( $_FILES['image'] ) ){
              >>>>>>
              >>>>>>$ftp_co nn = @ftp_connect( $default_ftp_se rver )or
              >>>>>>die('<b>E rror!</b>');
              >>>>>>@ftp_logi n( $ftp_conn, $default_ftp_us er, $default_ftp_pa ss )or
              >>>>>>die('<bEr ror!</b>');
              >>>>>>
              >>>>>>$uploaddi r = '../items/';
              >>>>>>$uploadfi le = $uploaddir . basename( $_FILES['image']['name'] );
              >>>>>>
              >>>>>>if ( move_uploaded_f ile( $_FILES['image']['tmp_name'], $uploadfile ) ){
              >>>>>> echo "File is valid, and was successfully uploaded.";
              >>>>>>} else {
              >>>>>> echo "Possible file upload attack!";
              >>>>>>};
              >>>>>>
              >>>>>>ftp_close ( $ftp_conn );
              >>>>>>
              >>>>>>};
              >>>>>>
              >>>>>>?>
              >>>>>><form action="<?php echo $PHP_SELF; ?>" method="post"
              >>>>>>enctype=" multipart/form-data" name="images" target="_top" id="images"
              >>>>>>class="fo rm">
              >>>>>> <input name="image" type="file" id="image">
              >>>>>> <br>
              >>>>>> <input type="submit" name="upload" id="upload" value="Upload">
              >>>>>> <input name="cancel" type="button" id="cancel" value="Cancel"
              >>>>>>onClick=" javascript:hist ory.go(-1) ">
              >>>>>></form><?php
              >>>>>>
              >>>>>> if (is_dir($upload dir)) {
              >>>>>> if ($dh = opendir($upload dir)) {
              >>>>>> while (($file = readdir($dh)) !== false) {
              >>>>>> if ($file !== '..' && $file !== '.') echo "filename: $file :
              >>>>>>filetyp e: " . filetype($uploa ddir . $file) . "<br>\r\n";
              >>>>>> }
              >>>>>> closedir($dh);
              >>>>>> }
              >>>>>> };
              >>>>>>
              >>>>>>?>
              >>>>>>----------------------------------------------------
              >>>>>
              >>>>>--
              >>>>>gburnore at DataBasix dot Com
              >>>>>---------------------------------------------------------------------------
              >>>>> How you look depends on where you go.
              >>>>>---------------------------------------------------------------------------
              >>>>>Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
              >>>>> | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
              >>>>>Official .sig, Accept no substitutes. | ÝÛ³ºÝ³Þ³ºÝ³³ÝÛº ݳ޳ºÝ³Ý³Þ³ºÝ³Ý ÝÛ³
              >>>>> | ÝÛ 0 1 7 2 3 / Ý³Þ 3 7 4 9 3 0 Û³
              >>>>>Black Helicopter Repair Services, Ltd.| Official Proof of Purchase
              >>>>>========== =============== =============== =============== =============== =====
              >>>>
              >>>>Hmm, i still get an error; i chmodded both the destination folder AND
              >>>>the executing script-file 755.
              >>>>
              >>>>Warning: move_uploaded_f ile(../items/bg.jpg): failed to open stream:
              >>>>Permissio n denied in
              >>>>/home/httpd/vhosts/domain.com/httpdocs/new/admin/ftptest.php on line 15
              >>>>
              >>>> Read mode Write mode Execute/search mode
              >>>>Owner + + +
              >>>>Group + - +
              >>>>Others + - +
              >>>>
              >>>>Frizzle.[/color]
              >>
              >>Standard (DW created files/dirs) have user 'domainname', permissions
              >>'rwx r-x r-x ',
              >>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
              >>--- --- '
              >>
              >>Frizzle.[/color]
              >
              >
              > Is there a possibility to upload files via PHP without Chmodding, and
              > keep the same group / permissions on uploaded files as those uploaded
              > with, say, DreamWeaver or WS_FTP ?
              >
              > Frizzle.
              >
              > (E.g. with ftp_put() wich i can't seem to get working.)
              >[/color]

              Only if you can ftp in as the web server.

              --
              =============== ===
              Remove the "x" from my email address
              Jerry Stuckle
              JDS Computer Training Corp.
              jstucklex@attgl obal.net
              =============== ===

              Comment

              • Jerry Stuckle

                #8
                Re: Chmod

                Chris H wrote:[color=blue]
                > I have a semi related chmod question that i think i know the answer too
                > alredy but just want to be sure...
                >
                > Is it possible using PHP to set the permissions on a folder created from
                > within a php application...
                >
                >[/color]

                Depends on your hosting company. If they allow it, yes.

                If the php application created it, the owner will be the user running the
                application - in the case of a web application, it would be the webserver's
                userid. So the application would be able to chmod the directory.

                However, if the directory is created by ftp (as another user), no, you won't be
                able to chmod the directory - at least not without going through a lot of hoops.

                --
                =============== ===
                Remove the "x" from my email address
                Jerry Stuckle
                JDS Computer Training Corp.
                jstucklex@attgl obal.net
                =============== ===

                Comment

                • Jerry Stuckle

                  #9
                  Re: Chmod

                  Gary L. Burnore wrote:[color=blue]
                  > On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
                  > <jstucklex@attg lobal.net> wrote:
                  > .
                  >[color=green][color=darkred]
                  >>>>Standard (DW created files/dirs) have user 'domainname', permissions
                  >>>>'rwx r-x r-x ',
                  >>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
                  >>>>--- --- '
                  >>>>
                  >>>>Frizzle.
                  >>>
                  >>>
                  >>>Is there a possibility to upload files via PHP without Chmodding, and
                  >>>keep the same group / permissions on uploaded files as those uploaded
                  >>>with, say, DreamWeaver or WS_FTP ?
                  >>>
                  >>>Frizzle.
                  >>>
                  >>>(E.g. with ftp_put() wich i can't seem to get working.)
                  >>>[/color]
                  >>
                  >>Only if you can ftp in as the web server.[/color]
                  >
                  >
                  > It depends on the ftp server, actually. Our ftp server correctly sets
                  > the permissions for you when you push. Seems your ISP has something
                  > set incorrectly.
                  >[/color]

                  No, he was asking how to upload files with PHP - not with FTP.

                  --
                  =============== ===
                  Remove the "x" from my email address
                  Jerry Stuckle
                  JDS Computer Training Corp.
                  jstucklex@attgl obal.net
                  =============== ===

                  Comment

                  • frizzle

                    #10
                    Re: Chmod


                    Jerry Stuckle wrote:[color=blue]
                    > Gary L. Burnore wrote:[color=green]
                    > > On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
                    > > <jstucklex@attg lobal.net> wrote:
                    > > .
                    > >[color=darkred]
                    > >>>>Standard (DW created files/dirs) have user 'domainname', permissions
                    > >>>>'rwx r-x r-x ',
                    > >>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
                    > >>>>--- --- '
                    > >>>>
                    > >>>>Frizzle.
                    > >>>
                    > >>>
                    > >>>Is there a possibility to upload files via PHP without Chmodding, and
                    > >>>keep the same group / permissions on uploaded files as those uploaded
                    > >>>with, say, DreamWeaver or WS_FTP ?
                    > >>>
                    > >>>Frizzle.
                    > >>>
                    > >>>(E.g. with ftp_put() wich i can't seem to get working.)
                    > >>>
                    > >>
                    > >>Only if you can ftp in as the web server.[/color]
                    > >
                    > >
                    > > It depends on the ftp server, actually. Our ftp server correctly sets
                    > > the permissions for you when you push. Seems your ISP has something
                    > > set incorrectly.
                    > >[/color]
                    >
                    > No, he was asking how to upload files with PHP - not with FTP.
                    >
                    > --
                    > =============== ===
                    > Remove the "x" from my email address
                    > Jerry Stuckle
                    > JDS Computer Training Corp.
                    > jstucklex@attgl obal.net
                    > =============== ===[/color]

                    Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
                    chmodding etc.
                    So i could mail a zipfile to a client, tell them to unpack it and
                    upload it, and
                    have the upload script up and running ... ?

                    Frizzle.

                    Comment

                    • Jerry Stuckle

                      #11
                      Re: Chmod

                      frizzle wrote:[color=blue]
                      > Jerry Stuckle wrote:
                      >[color=green]
                      >>Gary L. Burnore wrote:
                      >>[color=darkred]
                      >>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
                      >>><jstucklex@a ttglobal.net> wrote:
                      >>>.
                      >>>
                      >>>
                      >>>>>>Standar d (DW created files/dirs) have user 'domainname', permissions
                      >>>>>>'rwx r-x r-x ',
                      >>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
                      >>>>>>--- --- '
                      >>>>>>
                      >>>>>>Frizzle .
                      >>>>>
                      >>>>>
                      >>>>>Is there a possibility to upload files via PHP without Chmodding, and
                      >>>>>keep the same group / permissions on uploaded files as those uploaded
                      >>>>>with, say, DreamWeaver or WS_FTP ?
                      >>>>>
                      >>>>>Frizzle.
                      >>>>>
                      >>>>>(E.g. with ftp_put() wich i can't seem to get working.)
                      >>>>>
                      >>>>
                      >>>>Only if you can ftp in as the web server.
                      >>>
                      >>>
                      >>>It depends on the ftp server, actually. Our ftp server correctly sets
                      >>>the permissions for you when you push. Seems your ISP has something
                      >>>set incorrectly.
                      >>>[/color]
                      >>
                      >>No, he was asking how to upload files with PHP - not with FTP.
                      >>
                      >>--
                      >>============= =====
                      >>Remove the "x" from my email address
                      >>Jerry Stuckle
                      >>JDS Computer Training Corp.
                      >>jstucklex@att global.net
                      >>============= =====[/color]
                      >
                      >
                      > Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
                      > chmodding etc.
                      > So i could mail a zipfile to a client, tell them to unpack it and
                      > upload it, and
                      > have the upload script up and running ... ?
                      >
                      > Frizzle.
                      >[/color]

                      Frizzle,

                      No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
                      web server are.

                      When you ftp a file to the server, the owner of the file is the userid who
                      uploaded the file (signed into ftp). But when you upload via PHP, you're using
                      the web server, and the owner is the userid of the server itself.

                      --
                      =============== ===
                      Remove the "x" from my email address
                      Jerry Stuckle
                      JDS Computer Training Corp.
                      jstucklex@attgl obal.net
                      =============== ===

                      Comment

                      • frizzle

                        #12
                        Re: Chmod


                        Jerry Stuckle wrote:[color=blue]
                        > frizzle wrote:[color=green]
                        > > Jerry Stuckle wrote:
                        > >[color=darkred]
                        > >>Gary L. Burnore wrote:
                        > >>
                        > >>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
                        > >>><jstucklex@a ttglobal.net> wrote:
                        > >>>.
                        > >>>
                        > >>>
                        > >>>>>>Standar d (DW created files/dirs) have user 'domainname', permissions
                        > >>>>>>'rwx r-x r-x ',
                        > >>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
                        > >>>>>>--- --- '
                        > >>>>>>[/color][/color][/color]
                        [color=blue][color=green][color=darkred]
                        > >>>>>>Frizzle .
                        > >>>>>
                        > >>>>>
                        > >>>>>Is there a possibility to upload files via PHP without Chmodding, and
                        > >>>>>keep the same group / permissions on uploaded files as those uploaded
                        > >>>>>with, say, DreamWeaver or WS_FTP ?
                        > >>>>>
                        > >>>>>Frizzle.
                        > >>>>>
                        > >>>>>(E.g. with ftp_put() wich i can't seem to get working.)
                        > >>>>>
                        > >>>>
                        > >>>>Only if you can ftp in as the web server.
                        > >>>
                        > >>>
                        > >>>It depends on the ftp server, actually. Our ftp server correctly sets
                        > >>>the permissions for you when you push. Seems your ISP has something
                        > >>>set incorrectly.
                        > >>>
                        > >>
                        > >>No, he was asking how to upload files with PHP - not with FTP.
                        > >>
                        > >>--
                        > >>============= =====
                        > >>Remove the "x" from my email address
                        > >>Jerry Stuckle
                        > >>JDS Computer Training Corp.
                        > >>jstucklex@att global.net
                        > >>============= =====[/color]
                        > >
                        > >
                        > > Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
                        > > chmodding etc.
                        > > So i could mail a zipfile to a client, tell them to unpack it and
                        > > upload it, and
                        > > have the upload script up and running ... ?
                        > >
                        > > Frizzle.
                        > >[/color]
                        >
                        > Frizzle,
                        >
                        > No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
                        > web server are.
                        >
                        > When you ftp a file to the server, the owner of the file is the userid who
                        > uploaded the file (signed into ftp). But when you upload via PHP, you're using
                        > the web server, and the owner is the userid of the server itself.
                        >
                        > --
                        > =============== ===
                        > Remove the "x" from my email address
                        > Jerry Stuckle
                        > JDS Computer Training Corp.
                        > jstucklex@attgl obal.net
                        > =============== ===[/color]

                        Ok, thanks.
                        Not to go on and on about this, but the other thing i asked is
                        impossible as well then?

                        "So i could mail a zipfile to a client, tell them to unpack it and
                        upload it,
                        and have the upload script up and running ... ?"

                        Frizzle.

                        Comment

                        • Jerry Stuckle

                          #13
                          Re: Chmod

                          frizzle wrote:[color=blue]
                          > Jerry Stuckle wrote:
                          >[color=green]
                          >>frizzle wrote:
                          >>[color=darkred]
                          >>>Jerry Stuckle wrote:
                          >>>
                          >>>
                          >>>>Gary L. Burnore wrote:
                          >>>>
                          >>>>
                          >>>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
                          >>>>><jstucklex @attglobal.net> wrote:
                          >>>>>.
                          >>>>>
                          >>>>>
                          >>>>>
                          >>>>>>>>Standar d (DW created files/dirs) have user 'domainname', permissions
                          >>>>>>>>'rwx r-x r-x ',
                          >>>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
                          >>>>>>>>--- --- '
                          >>>>>>>>[/color][/color]
                          >
                          >[color=green][color=darkred]
                          >>>>>>>>Frizzle .
                          >>>>>>>
                          >>>>>>>
                          >>>>>>>Is there a possibility to upload files via PHP without Chmodding, and
                          >>>>>>>keep the same group / permissions on uploaded files as those uploaded
                          >>>>>>>with, say, DreamWeaver or WS_FTP ?
                          >>>>>>>
                          >>>>>>>Frizzl e.
                          >>>>>>>
                          >>>>>>>(E.g. with ftp_put() wich i can't seem to get working.)
                          >>>>>>>
                          >>>>>>
                          >>>>>>Only if you can ftp in as the web server.
                          >>>>>
                          >>>>>
                          >>>>>It depends on the ftp server, actually. Our ftp server correctly sets
                          >>>>>the permissions for you when you push. Seems your ISP has something
                          >>>>>set incorrectly.
                          >>>>>
                          >>>>
                          >>>>No, he was asking how to upload files with PHP - not with FTP.
                          >>>>
                          >>>>--
                          >>>>=========== =======
                          >>>>Remove the "x" from my email address
                          >>>>Jerry Stuckle
                          >>>>JDS Computer Training Corp.
                          >>>>jstucklex@a ttglobal.net
                          >>>>=========== =======
                          >>>
                          >>>
                          >>>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
                          >>>chmodding etc.
                          >>>So i could mail a zipfile to a client, tell them to unpack it and
                          >>>upload it, and
                          >>>have the upload script up and running ... ?
                          >>>
                          >>>Frizzle.
                          >>>[/color]
                          >>
                          >>Frizzle,
                          >>
                          >>No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
                          >>web server are.
                          >>
                          >>When you ftp a file to the server, the owner of the file is the userid who
                          >>uploaded the file (signed into ftp). But when you upload via PHP, you're using
                          >>the web server, and the owner is the userid of the server itself.
                          >>
                          >>--
                          >>============= =====
                          >>Remove the "x" from my email address
                          >>Jerry Stuckle
                          >>JDS Computer Training Corp.
                          >>jstucklex@att global.net
                          >>============= =====[/color]
                          >
                          >
                          > Ok, thanks.
                          > Not to go on and on about this, but the other thing i asked is
                          > impossible as well then?
                          >
                          > "So i could mail a zipfile to a client, tell them to unpack it and
                          > upload it,
                          > and have the upload script up and running ... ?"
                          >
                          > Frizzle.
                          >[/color]

                          It's easy to ftp or to upload via PHP. Both work quite well (unless the
                          server's configuration is screwed up). It's when you try to mix the two you
                          start running into permission problems and need to chmod.

                          --
                          =============== ===
                          Remove the "x" from my email address
                          Jerry Stuckle
                          JDS Computer Training Corp.
                          jstucklex@attgl obal.net
                          =============== ===

                          Comment

                          • frizzle

                            #14
                            Re: Chmod


                            Jerry Stuckle wrote:[color=blue]
                            > frizzle wrote:[color=green]
                            > > Jerry Stuckle wrote:
                            > >[color=darkred]
                            > >>frizzle wrote:
                            > >>
                            > >>>Jerry Stuckle wrote:
                            > >>>
                            > >>>
                            > >>>>Gary L. Burnore wrote:
                            > >>>>
                            > >>>>
                            > >>>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
                            > >>>>><jstucklex @attglobal.net> wrote:
                            > >>>>>.
                            > >>>>>
                            > >>>>>
                            > >>>>>
                            > >>>>>>>>Standar d (DW created files/dirs) have user 'domainname', permissions
                            > >>>>>>>>'rwx r-x r-x ',
                            > >>>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
                            > >>>>>>>>--- --- '
                            > >>>>>>>>[/color]
                            > >
                            > >[color=darkred]
                            > >>>>>>>>Frizzle .
                            > >>>>>>>
                            > >>>>>>>
                            > >>>>>>>Is there a possibility to upload files via PHP without Chmodding, and
                            > >>>>>>>keep the same group / permissions on uploaded files as those uploaded
                            > >>>>>>>with, say, DreamWeaver or WS_FTP ?
                            > >>>>>>>
                            > >>>>>>>Frizzl e.
                            > >>>>>>>
                            > >>>>>>>(E.g. with ftp_put() wich i can't seem to get working.)
                            > >>>>>>>
                            > >>>>>>
                            > >>>>>>Only if you can ftp in as the web server.
                            > >>>>>
                            > >>>>>
                            > >>>>>It depends on the ftp server, actually. Our ftp server correctly sets
                            > >>>>>the permissions for you when you push. Seems your ISP has something
                            > >>>>>set incorrectly.
                            > >>>>>
                            > >>>>
                            > >>>>No, he was asking how to upload files with PHP - not with FTP.
                            > >>>>
                            > >>>>--
                            > >>>>=========== =======
                            > >>>>Remove the "x" from my email address
                            > >>>>Jerry Stuckle
                            > >>>>JDS Computer Training Corp.
                            > >>>>jstucklex@a ttglobal.net
                            > >>>>=========== =======
                            > >>>
                            > >>>
                            > >>>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
                            > >>>chmodding etc.
                            > >>>So i could mail a zipfile to a client, tell them to unpack it and
                            > >>>upload it, and
                            > >>>have the upload script up and running ... ?
                            > >>>
                            > >>>Frizzle.
                            > >>>
                            > >>
                            > >>Frizzle,
                            > >>
                            > >>No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
                            > >>web server are.
                            > >>
                            > >>When you ftp a file to the server, the owner of the file is the userid who
                            > >>uploaded the file (signed into ftp). But when you upload via PHP, you're using
                            > >>the web server, and the owner is the userid of the server itself.
                            > >>
                            > >>--
                            > >>============= =====
                            > >>Remove the "x" from my email address
                            > >>Jerry Stuckle
                            > >>JDS Computer Training Corp.
                            > >>jstucklex@att global.net
                            > >>============= =====[/color]
                            > >
                            > >
                            > > Ok, thanks.
                            > > Not to go on and on about this, but the other thing i asked is
                            > > impossible as well then?
                            > >
                            > > "So i could mail a zipfile to a client, tell them to unpack it and
                            > > upload it,
                            > > and have the upload script up and running ... ?"
                            > >
                            > > Frizzle.
                            > >[/color]
                            >
                            > It's easy to ftp or to upload via PHP. Both work quite well (unless the
                            > server's configuration is screwed up). It's when you try to mix the two you
                            > start running into permission problems and need to chmod.
                            >
                            > --
                            > =============== ===
                            > Remove the "x" from my email address
                            > Jerry Stuckle
                            > JDS Computer Training Corp.
                            > jstucklex@attgl obal.net
                            > =============== ===[/color]

                            owkaaaaayyyy, i never realized ftp and uploading aren't the same
                            thing...
                            I don't need to mix them, i need a script to upload files, wich can
                            prefferably
                            run without any chmodding etc.

                            Frizzle.

                            Comment

                            • Jerry Stuckle

                              #15
                              Re: Chmod

                              frizzle wrote:[color=blue]
                              > Jerry Stuckle wrote:
                              >[color=green]
                              >>frizzle wrote:
                              >>[color=darkred]
                              >>>Jerry Stuckle wrote:
                              >>>
                              >>>
                              >>>>frizzle wrote:
                              >>>>
                              >>>>
                              >>>>>Jerry Stuckle wrote:
                              >>>>>
                              >>>>>
                              >>>>>
                              >>>>>>Gary L. Burnore wrote:
                              >>>>>>
                              >>>>>>
                              >>>>>>
                              >>>>>>>On Wed, 05 Apr 2006 07:55:14 -0500, Jerry Stuckle
                              >>>>>>><jstuckl ex@attglobal.ne t> wrote:
                              >>>>>>>.
                              >>>>>>>
                              >>>>>>>
                              >>>>>>>
                              >>>>>>>
                              >>>>>>>>>>Stand ard (DW created files/dirs) have user 'domainname', permissions
                              >>>>>>>>>>'rw x r-x r-x ',
                              >>>>>>>>>>Ftp app uploaded (with chmod 777) have user 'apache', permissions 'rw-
                              >>>>>>>>>>--- --- '
                              >>>>>>>>>>
                              >>>
                              >>>
                              >>>>>>>>>>Frizz le.
                              >>>>>>>>>
                              >>>>>>>>>
                              >>>>>>>>>Is there a possibility to upload files via PHP without Chmodding, and
                              >>>>>>>>>keep the same group / permissions on uploaded files as those uploaded
                              >>>>>>>>>with , say, DreamWeaver or WS_FTP ?
                              >>>>>>>>>
                              >>>>>>>>>Frizzl e.
                              >>>>>>>>>
                              >>>>>>>>>(E.g . with ftp_put() wich i can't seem to get working.)
                              >>>>>>>>>
                              >>>>>>>>
                              >>>>>>>>Only if you can ftp in as the web server.
                              >>>>>>>
                              >>>>>>>
                              >>>>>>>It depends on the ftp server, actually. Our ftp server correctly sets
                              >>>>>>>the permissions for you when you push. Seems your ISP has something
                              >>>>>>>set incorrectly.
                              >>>>>>>
                              >>>>>>
                              >>>>>>No, he was asking how to upload files with PHP - not with FTP.
                              >>>>>>
                              >>>>>>--
                              >>>>>>========= =========
                              >>>>>>Remove the "x" from my email address
                              >>>>>>Jerry Stuckle
                              >>>>>>JDS Computer Training Corp.
                              >>>>>>jstucklex @attglobal.net
                              >>>>>>========= =========
                              >>>>>
                              >>>>>
                              >>>>>Sorry, kind of lost it here; is it possible to FTP via PHP w/o any
                              >>>>>chmoddin g etc.
                              >>>>>So i could mail a zipfile to a client, tell them to unpack it and
                              >>>>>upload it, and
                              >>>>>have the upload script up and running ... ?
                              >>>>>
                              >>>>>Frizzle.
                              >>>>>
                              >>>>
                              >>>>Frizzle,
                              >>>>
                              >>>>No, you can't upload via PHP. FTP is a system service, just as telnet, ssh and
                              >>>>web server are.
                              >>>>
                              >>>>When you ftp a file to the server, the owner of the file is the userid who
                              >>>>uploaded the file (signed into ftp). But when you upload via PHP, you're using
                              >>>>the web server, and the owner is the userid of the server itself.
                              >>>>
                              >>>>--
                              >>>>=========== =======
                              >>>>Remove the "x" from my email address
                              >>>>Jerry Stuckle
                              >>>>JDS Computer Training Corp.
                              >>>>jstucklex@a ttglobal.net
                              >>>>=========== =======
                              >>>
                              >>>
                              >>>Ok, thanks.
                              >>>Not to go on and on about this, but the other thing i asked is
                              >>>impossible as well then?
                              >>>
                              >>> "So i could mail a zipfile to a client, tell them to unpack it and
                              >>>upload it,
                              >>> and have the upload script up and running ... ?"
                              >>>
                              >>>Frizzle.
                              >>>[/color]
                              >>
                              >>It's easy to ftp or to upload via PHP. Both work quite well (unless the
                              >>server's configuration is screwed up). It's when you try to mix the two you
                              >>start running into permission problems and need to chmod.
                              >>
                              >>--
                              >>============= =====
                              >>Remove the "x" from my email address
                              >>Jerry Stuckle
                              >>JDS Computer Training Corp.
                              >>jstucklex@att global.net
                              >>============= =====[/color]
                              >
                              >
                              > owkaaaaayyyy, i never realized ftp and uploading aren't the same
                              > thing...
                              > I don't need to mix them, i need a script to upload files, wich can
                              > prefferably
                              > run without any chmodding etc.
                              >
                              > Frizzle.
                              >[/color]

                              Ok, you just need to ensure you have the original directory permissions set
                              properly, then. In a typical installation the directory would be owned by the
                              webserver's userid with permissions of 755.

                              And I hope I didn't confuse you. You can upload via HTTP, or with the ftp PUT
                              command. In either case the file ends up on the server. But how it gets there
                              is much different.


                              --
                              =============== ===
                              Remove the "x" from my email address
                              Jerry Stuckle
                              JDS Computer Training Corp.
                              jstucklex@attgl obal.net
                              =============== ===

                              Comment

                              Working...