?
Solved

Access file over network with username and password

Posted on 2014-03-03
8
Medium Priority
?
536 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 58

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 111

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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 58

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 111

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 58

Accepted Solution

by:
Julian Hansen earned 2000 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

Supports up to 4K resolution!

The VS192 2-Port 4K DisplayPort Splitter is perfect for anyone who needs to send one source of DisplayPort high definition video to two or four DisplayPort displays. The VS192 can split and also expand DisplayPort audio/video signal on two or four DisplayPort monitors.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
What You Need to Know when Searching for a Webhost Provider
The viewer will learn how to count occurrences of each item in an array.
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.
Suggested Courses

777 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