ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My office has ~24 Windows machines connected to a Windows file server. I want to provide a Linux web interface for a few features, including access to files in the Windows file server. Problem is that if a Windows user clicks a link to a file, that file will get downloaded from the file server to the Windows machine: I need for the Windows machine to open the file same as if Windows Explorer was used. Put another way, I need for the client to open the file in the file server, not download and open a copy of the file.
I've tried ssh, but I don't know how to make the leap (process-wise) from the Linux system to the Windows system. Is it possible to have a web-page script execute a command (with arguments) on the client machine?
This is strictly for in-house use, so security needs are only moderate. If a deamon is needed on the client machines, that's okay as long as it works seamlessly. The only objective is to make the files on the server more easily accessed by the users. I don't know much programming, but I'm learning whatever I need to do this: I've gotten into HTML, php, Bash, mySQL and Perl, but I think C may be too much. If Java can do this, that may be okay. I'm not the sys admin, but we really don't have one at all. I'm sure you have questions....
You can start an application in IE
Solution 1)
*
there must be a shortcut on the users desktop (i.e. to msword)
*
type the name of the shortcut in the address bar and it will launch the application
Solution 2)
*
the following html example shows how to create a link that will start an app (in this case pfe32)
In both cases, you must check if it's possible to pass arguments; I did not manage in a short time to get it right.
Further, in both cases, there will be a reference to a drive somewhere (the shortcut will refer to a program on a drive, the html file will refer to a drive). This requires samba on the linux machine to be configured so you can map network drives.
And when you use samba, it might be just as easy to map the network drive so the users can start the application from windows explorer.
And last, but not least, this might only work in IE. Or will involve changes in security settings of the browser.
the following html example shows how to create a link that will start an app (in this case pfe32)...
That works fine in an HTML document on the user's machine. And if the link is to a file, Windows will ask if you want to open the file in the default application ( e.g. file:///c:/letter.doc -> winword.exe). But it won't work if the HTML is on a web server: the web server cannot see above its own root which is at /var/www/html/ or something similar, so the web server says it can't find the file. I tried mounting the Windows shares under the web server root and that's where the file gets copied to the client, instead of allowing the client to open the original file. Even if the file could be opened through the web server, there is the issue of locking the file....
AFAIK don't think it is doable with just a webserver/web browser. Why not use samba?
The issue is not accessing files, but rather opening them as in editing them, using the correct application. I see 2 different ways that it might be done:
clientUser clicks web page link for a file
webServer runs a CGI program, using the selected file as a variable which tells the Windows client machine to open the file at which time the Windows machine opens the file on the Windows fileserver.
...or...
clientUser clicks web page link for a file
webServer drops a cookie on the Windows client
a daemon running on the Windows machine causes the Windows client machine to open the file at which time the Windows machine opens the file on the Windows fileserver.
I have done this:
Installed freesshd on the Windows machine.
Run ssh from the Linux machine to connect to the Windows machine (this gets a DOS command prompt).
At the DOS command line, do 'start progname.exe filename' and then the file opens as it should on the Windows machine.
I want to do pretty much the same thing, except I don't know how to deal with the leap from the *nix shell to the DOS shell. And if you think the answer is CygWin, please explain what command at the CygWin prompt would do the same as the 'start prog...' command does at the DOS prompt.
You can configure windows to open the file in the application instead of the web browser or downloading when you click on a file. The problem lies in saving changes back to the server.
Samba allows file/print sharing between linux and windows. You can access the linux file server via network neighborhood, connect to it as a drive letter, have the capability to click on a file in explorer and have file locking capabilities.
I do not understand the advantage of your web broswer vs the windows file server.
Good point. Opening files is only part of what I want to do and it's the only part that I see a problem with. We have a bunch of active projects, each with 2 folders on the file server (on 2 DIFFERENT drives...) and other project-specific files outside of those folders. At this time, for users to access any given file, they need to know the job number (find a hard-copy list...) and then click this-click-that etc to get to where they want to be. Right now, other than the common job number, there is no connection between the project "docs" folder and the project "cad" folder. My plan is to have a web interface where the user can enter a job number or run a search on key words or whatever for the job description, client, whatever in order to access a dynamically generated "home page" for the project. The home page would have content which is not readily shared in our present scheme and it would naturally provide links to the project files. Granted, the file server system is poorly organized and fixing that could make things a bit better, but, as I said, I'm not the sysadmin (and I don't want to be: but I wouldn't mind being the one to hire the one to replace our current one...).
That works fine in an HTML document on the user's machine. And if the link is to a file, Windows will ask if you want to open the file in the default application ( e.g. file:///c:/letter.doc -> winword.exe). But it won't work if the HTML is on a web server: the web server cannot see above its own root which is at /var/www/html/ or something similar, so the web server says it can't find the file. I tried mounting the Windows shares under the web server root and that's where the file gets copied to the client, instead of allowing the client to open the original file. Even if the file could be opened through the web server, there is the issue of locking the file....
Thanks for your thoughts, though.
You wanted to start an application, not open a file with an application. But OK ..., probably my misunderstanding.
Unless I understand you incorrectly: a webserver can see above the root. That's the way that I hide i.e. files with passwords for database access.
Code:
DocumentRoot "/server/www/htdocs/btd/web"
apache can still access files in /server/www/htdocs/btd/ or /server/www/htdocs/btd/other_directory
With regards to the locking: Somewhere I hear something whisper CVS ... CVS ... CVS ... CVS. People can check out drawings, modify them and commit them. If someone else checks out the same drawing, modifies it and commits it, he/she will at least be warned that the file was modified by another user.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.