dos2unix on a file upload

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

    dos2unix on a file upload

    Hi there,

    Does anybody know of some restriction that stops the apache user on
    doing a dos2unix on a file upload from php? I'm getting 'permission
    denied' on some temp file that it tries to create.

    I tried doing it from the command line by manually placing a fake
    upload file in /tmp:

    [dave@willow dave]$ ls -ltr /tmp
    -rw------- 1 apache apache 307 Mar 10 11:32 phpjmyaQR
    [dave@willow dave]$ sudo -u apache dos2unix /tmp/phpjmyaQR
    dos2unix: converting file /tmp/phpjmyaQR to UNIX format ...
    Failed to open output temp file: Permission denied
    dos2unix: problems converting file /tmp/phpjmyaQR

    However if I change the owner and group to me, it will work fine:

    [dave@willow dave]$ ls -l /tmp
    -rw------- 1 dave dave 307 Mar 10 14:53 phpjmyaQR
    [dave@willow dave]$ sudo -u dave dos2unix /tmp/phpjmyaQR
    dos2unix: converting file /tmp/phpdave to UNIX format ...
    [dave@willow dave]$


    Red Hat Linux 3.2.2-5
    Apache 2.0.40

    Ta,
    Dave
  • Reply Via Newsgroup

    #2
    Re: dos2unix on a file upload

    david wrote:
    [color=blue]
    > Hi there,
    >
    > Does anybody know of some restriction that stops the apache user on
    > doing a dos2unix on a file upload from php? I'm getting 'permission
    > denied' on some temp file that it tries to create.
    >
    > I tried doing it from the command line by manually placing a fake
    > upload file in /tmp:
    >
    > [dave@willow dave]$ ls -ltr /tmp
    > -rw------- 1 apache apache 307 Mar 10 11:32 phpjmyaQR
    > [dave@willow dave]$ sudo -u apache dos2unix /tmp/phpjmyaQR
    > dos2unix: converting file /tmp/phpjmyaQR to UNIX format ...
    > Failed to open output temp file: Permission denied
    > dos2unix: problems converting file /tmp/phpjmyaQR
    >
    > However if I change the owner and group to me, it will work fine:
    >
    > [dave@willow dave]$ ls -l /tmp
    > -rw------- 1 dave dave 307 Mar 10 14:53 phpjmyaQR
    > [dave@willow dave]$ sudo -u dave dos2unix /tmp/phpjmyaQR
    > dos2unix: converting file /tmp/phpdave to UNIX format ...
    > [dave@willow dave]$
    >
    >
    > Red Hat Linux 3.2.2-5
    > Apache 2.0.40
    >
    > Ta,
    > Dave[/color]

    Correct me if I am wrong but the following
    [color=blue]
    > [dave@willow dave]$ ls -ltr /tmp
    > -rw------- 1 apache apache 307 Mar 10 11:32 phpjmyaQR[/color]


    tells me that you are logged in as user dave true?

    And the file phpjyaQR has read/write permissions for owner/group
    apache/apache only - nobody else.

    Thus - since only user/group apache/apache has access to the file, this
    would explain when you are user dave as to why you get a 'Failed to
    open' and permission denied message.

    If you have access to user 'apache' then su to it and try and perform
    your dos2unix command and it should work from there.

    In addition, check the syntax for the command as I *think* you should be
    executing

    $ dos2unix originalFile > convertedFilena me

    randelld

    Comment

    Working...