473,383 Members | 1,788 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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
Jul 17 '05 #1
1 13105
david wrote:
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
Correct me if I am wrong but the following
[dave@willow dave]$ ls -ltr /tmp
-rw------- 1 apache apache 307 Mar 10 11:32 phpjmyaQR

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 > convertedFilename

randelld
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
2
by: mark | last post by:
How do I detect that a particular form element is a file upload or if the file upload has worked? In the Python cgi module documentation I found suggested code... form = cgi.FieldStorage()...
7
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file"...
4
by: Tam OShanter | last post by:
Hello, I have a .NET application that FTP's text files to a Unix server for further processing. One of the step in the processing on the Unix server is running each text file through the...
2
by: hotflash | last post by:
Hi All, I found the best pure ASP code to upload a file to either server and/or MS Access Database. It works fine for me however, there is one thing that I don't like and have tried to fix but...
1
by: chrisj | last post by:
I'm using freeASPupload and got some assistance integrating to a Member script. It works successfully. In this modified version there are two groups that use this upload script. Members of one...
6
Jacotheron
by: Jacotheron | last post by:
I need a PHP script that can upload music files (mp3). The script is for a home project I have started a while ago. I have a MySQL database of all the music that I have. Other computers on the...
1
by: chennaibala | last post by:
can any one send me mutiple image upload program and save the file name with extension in mysql table.we must cheak uploaded file type like bmp or any image file while uploading. i develop...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.