Solved

Access file over network with username and password

Posted on 2014-03-03
8
531 Views
Last Modified: 2014-03-12
Is it possible to connect to a network file share over a network with a different username and password other than www-data.

I've got a ubuntu web server, but not much storage space, however on the same network I've got 4TB available but only network sharing with usernames and passwords.

I need to be able to read write to the share if possible as well. I can access via FTP if needed though.
0
Comment
Question by:tonelm54
  • 3
  • 2
  • 2
8 Comments
 

Author Comment

by:tonelm54
ID: 39901650
What Im hoping is a way of doing something similar to:-
	$data = file_get_contents('//username:password@server/myShare/myFolder/myFile.dat');
	
	echo $data;

Open in new window


So in real terms:-
	$data = file_get_contents('//tcross:64TTyr6@192.168.1.55/storage/myWebStore1/file0006.dat');
	
	echo $data;

Open in new window

0
 
LVL 53

Expert Comment

by:Julian Hansen
ID: 39902990
Why do you want to connect via the webserver - why not mount the network share to the system as an admin at which point it will be available to your web server?
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39903326
You might be able to do this with cURL.  Please set up the test data URL (a portion of the  SSCCE) and tell us what credentials you want us to use.  I'll be glad to make a test and show you the results.
0
Free camera licenses with purchase of My Cloud NAS

Milestone Arcus software is compatible with thousands of industry-leading cameras for added flexibility. Upon installation on your My Cloud NAS, you will receive two (2) camera licenses already enabled in the software. And for a limited time, get additional camera licenses FREE.

 
LVL 53

Expert Comment

by:Julian Hansen
ID: 39903770
You might be able to do this with cURL.
Only if there is a web service listening on the other side. I interpret the question as requiring file access to a file on a remote share - in which case cUrl is not viable.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39903874
@julianH: I'll wait for the author to post the credentials before I give up on any particular solution.  

I may be missing something of the economics in this question, since a gigabyte of storage can be purchased for the cost of a few sheets of toilet paper.  To me it would seem obvious and easy to just add storage to the web server.
0
 

Author Comment

by:tonelm54
ID: 39910685
Unfortunately I'm stuck with the host size, I cannot increase it. However I do have several TB on another server Im able to use. My thought is at the moment is to use FTP to copy the file into a temporary store on the host then serve it as needed.
0
 
LVL 53

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 39911689
Is the other server only accessible via FTP or is it possible to mount the remote volume on your http server?

Do the contents of the files change?

If not then you might want to consider implementing a file caching solution - where the files that are requested the most frequently are cached on the server to boost performance - having to wait for an FTP connect and transfer could degrade overall performance of your site.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now