473,769 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 13126
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 > convertedFilena me

randelld
Jul 17 '05 #2

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

Similar topics

2
3930
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 them a caption, storing the caption and filename in a text file. It's a bit buggy when removing the photos and captions from the file, and also in displaying them on the delete page. you can see it in action at www.4am.com.au/gallery/upload.php...
13
4321
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 that this is suppossed to end up as a component for others to use, and therefore I do NOT have access to their global.cs::Session_End() how do I cleanup files that were uploaded -- but obviously left stranded when the users aborted/gave up writting...
2
3436
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() fileitem = form if fileitem.file: # It's an uploaded file; count lines
7
3190
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" name="file_1" size=46 /><input type=submit /> so, after adding a few files, the input fields look like this:
4
3827
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 dos2unix utility. dos2Unix converts Dos text file line endings to Unix line endings.
2
7651
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 don't have any luck is to do a form validation. This script requires the files: db-file-to-disk.asp and _upload.asp. There is a DESCRIPTION field in the db-file-to-disk.asp file, what I want to do is the user has to field out this fied before...
1
5457
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 group get automatically re-directed after uploading. However, this member group never gets the benefit of knowing if they've uploaded an incorrect file size or incorrect file extension. Members from the second group do see the "exceeds max file...
6
3837
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 network should be able to connect to the database and run queries on the database or upload new music that does not yet exist on the database. The uploaded file's name should be in the following format: ARTIST - TITLE.mp3. I have the code to upload images,...
1
4884
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 program,which can upload many file in folder.problem is,am unable to save my file name in to database.because i used same name for all input file type as file. i dont know get name of file.below i presented my coding for ur view.fed up with my coding..pls...
0
9583
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10039
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6668
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5297
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5445
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3560
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.