安装CIFS客户端/与系统/安装座的连接
我正在尝试在Ubuntu客户端桌面和Windows 10服务器桌面之间建立CIFS连接,因此我可以通过本地网络共享文件夹和文件。 我的代码如下:
#include <sys/mount.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <string>
using namespace std;
int main()
{
string src = "//xxx.xxx.x.xxx/shared_folder"; //xxx.xxx.x.xxx should be replaced by the server IP. shared_folder is my folder shared on the server side
string dst = "/opt/share";//My shared folder on Linux
string fstype = "cifs";
printf("src: %s\n", src.c_str());
if( -1 == mount(src.c_str(), dst.c_str(), fstype.c_str(), MS_MGC_VAL | MS_SILENT , "[email protected],password=mypassword") )
{
printf("mount failed with error: %s\n",strerror(errno));
}
else
printf("mount success!\n");
return 0;
}
但是它总是返回:
src: //xxx.xxx.x.xxx/shared_folder
mount failed with error: Operation not permitted
[1] + Done "/usr/bin/gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-fmryivr5.02p" 1>"/tmp/Microsoft-MIEngine-Out-zfdhv3x2.zc5"
请问吗?
I am trying to make a CIFS connection between my Ubuntu client desktop and my Windows 10 server Desktop, so I can share folders and files though a local network.
My code is the following:
#include <sys/mount.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <string>
using namespace std;
int main()
{
string src = "//xxx.xxx.x.xxx/shared_folder"; //xxx.xxx.x.xxx should be replaced by the server IP. shared_folder is my folder shared on the server side
string dst = "/opt/share";//My shared folder on Linux
string fstype = "cifs";
printf("src: %s\n", src.c_str());
if( -1 == mount(src.c_str(), dst.c_str(), fstype.c_str(), MS_MGC_VAL | MS_SILENT , "[email protected],password=mypassword") )
{
printf("mount failed with error: %s\n",strerror(errno));
}
else
printf("mount success!\n");
return 0;
}
But it always returns:
src: //xxx.xxx.x.xxx/shared_folder
mount failed with error: Operation not permitted
[1] + Done "/usr/bin/gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-fmryivr5.02p" 1>"/tmp/Microsoft-MIEngine-Out-zfdhv3x2.zc5"
Any clue, please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论