在 Linux 环境中运行的 PHP 的 Windows 网络驱动器 [英] Windows network drive from PHP running on a linux environment

查看:25
本文介绍了在 Linux 环境中运行的 PHP 的 Windows 网络驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须检查一下它是否有效.

I have to check something if it works.

我们通过 ssh 对 Debian 服务器的访问受到限制.我们在这台服务器上运行了一个 PHP 内网解决方案,因此我们可以运行 PHP 脚本.我们得到了以下场景:

We have limited access to a Debian server via ssh. We have a PHP intranet solution running on this server, so we can run PHP scripts. We got the following scenario:

给定的 Windows 网络驱动器:\\IP\folder$

A windows network drive given: \\IP\folder$

我们必须在linux下从PHP读取这个windows网络驱动器.我从来没有做过这样的事情.

We have to read this windows network drive from PHP under linux. I never did such thing.

我们无权在服务器上挂载任何东西.这个驱动器可能会也可能不会从 linux 机器访问,我不知道.(由于场景的原因,我猜它是可以访问的).

We have no any rights to mount anything on the server. This drive may or may not accessable from the linux machine, I don't know. (I guess it's accessable, due to the scenario).

我们没有收到驱动器的任何用户和通行证,所以我想我们不需要它.

We didn't receive any user&pass for the drive, so I guess we don't need it.

问题是:如果一切都在客户端正确设置,在这种情况下是否有可能做到这一点?如果是,如何?

The question is: is it possible to do this in this situation if everything was set up correctly on the customer side? If yes, how?

如果需要,我们可以询问更多信息和配置更改,但我想知道我们现在是否可以这样做,因为这很有趣.

We can ask more information and configuration changes if we need it, but I'm wondering if we can do this now, because it's interesting.

提前致谢,

推荐答案

您可以使用 smbclient 访问共享.您可以将其视为一种ftp"客户端,但用于访问 Windows 共享.它无需挂载即可工作,您应该能够使用 popen() 用于命令/结果的双向通信.

You can use smbclient to access the share. You could consider it as a sort of 'ftp' client, but for accessing Windows shares instead. It can work without need for mounting, and you should be able to talk to it directly from PHP using popen() for bi-directional communication of commands/results.

然而,这取决于实际可远程访问的共享,以及您对它的访问权限(通过 Windows 帐户或具有所有人/阅读"权限的共享).如果 Windows 网络有防火墙和/或您没有访问权限,则您无法直接访问文件.

However, this depends on the share actually being remotely accessible, and you having access rights to it (via a windows account or the share having 'everyone/read' permissions). If windows networking is firewalled and/or you don't have access permissions, then there's nothing you can do to access the files directly.

这篇关于在 Linux 环境中运行的 PHP 的 Windows 网络驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆