Solved

Access file over network with username and password

Posted on 2014-03-03
8
527 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 51

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
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 51

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 51

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

746 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

13 Experts available now in Live!

Get 1:1 Help Now