Linux 从centos挂载远程windows共享
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18670170/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
mount remote windows share from centos
提问by richardwhitney
I am trying to setup a script that will:
我正在尝试设置一个脚本,它将:
- Connect to a windows share
- Using LOAD DATA LOCAL INFILE, upload the two files into their appropriate db tables
- Umount share
- 连接到 Windows 共享
- 使用 LOAD DATA LOCAL INFILE,将两个文件上传到相应的数据库表中
- 卸载共享
Situation:
I can currently vpnc into this remote machine
情况:
我目前可以 vpnc 进入这台远程机器
Problem:
I cannot
问题:
我不能
mount -t cifs //ip.address/share /mnt/point -o username=u,password=p,port=445
mount error(110) Connection timed out
I am attempting to do this manually first
Remote server is open to port 445
我首先尝试手动执行此操作
远程服务器对端口 445 开放
Questions:
问题:
- Do I even need to vpnc in first?
- Do I need to do route add for the remote ip/mask/gw after vpnc?
- 我什至需要先使用 vpnc 吗?
- 是否需要在 vpnc 之后为远程 ip/mask/gw 添加路由?
Thank you!
谢谢!
采纳答案by Girish KG
The mount.cifsfile is provided by the samba-clientpackage. This can be installed from the standard CentOS yum repository by running the following command:
该mount.cifs文件是由所提供的samba的客户机包。这可以通过运行以下命令从标准 CentOS yum 存储库安装:
yum install samba samba-client cifs-utils
Once installed, you can mount a Windows SMB share on your CentOS server by running the following command:
安装后,您可以通过运行以下命令在 CentOS 服务器上挂载 Windows SMB 共享:
Syntax:
句法:
mount.cifs //SERVER_ADDRESS/SHARE_NAME MOUNT_POINT -o user=USERNAME
SERVER_ADDRESS:Windows system's IP address or hostname
SERVER_ADDRESS:Windows 系统的 IP 地址或主机名
SHARE_NAME:The name of the shared folder configured on the Windows system
SHARE_NAME:Windows系统上配置的共享文件夹的名称
USERNAME:Windows user that has access to this share
USERNAME:有权访问此共享的 Windows 用户
MOUNT_POINT:The local mount point on your CentOS server
MOUNT_POINT:CentOS 服务器上的本地挂载点
I am mounting to a share from \\10.11.10.26\snaps
我正在从\\10.11.10.26\snaps安装到共享
Make a directory under mount for your reference
在mount下建一个目录供大家参考
mkdir /mnt/mymount
Now I am mounting the snaps folder from indiafps02, User name is the Domain credentials, i.e. Mydomain in this case
现在我正在从 indiafps02 安装 snaps 文件夹,用户名是域凭据,即 Mydomain 在这种情况下
mount.cifs //10.11.10.26/snaps /mnt/mymount -o user=Girish.KG
Now you could see the content by typing
现在您可以通过键入来查看内容
ls /mnt/mymount
So, after performing your task, just fire umount command
因此,在执行您的任务后,只需触发 umount 命令
umount /mnt/mymount
That's it. You are done.
就是这样。你完成了。
回答by user11924021
no need to install "samba" and "samba-client", only "cifs-utils" using command
无需安装“samba”和“samba-client”,只需使用命令“cifs-utils”
yum install cifs-utils
yum 安装 cifs-utils
after that in windows share the folder you would like to mount in centos if you didn't do that already ("c:\interpub\wwwroot" in my case).
之后,如果您还没有这样做,则在 Windows 中共享您想要在 centos 中安装的文件夹(在我的情况下为“c:\interpub\wwwroot”)。
make sure you share it with a specific username whom your know the password for ("netops" in my case).
确保您与您知道密码的特定用户名共享它(在我的情况下为“netops”)。
create a directory in centos in which you would like to mount the windows share in to ("/mnt/cm" in my case).
在 centos 中创建一个目录,您希望在其中安装 Windows 共享(在我的情况下为“/mnt/cm”)。
after that run that simple command as a root
之后以root身份运行那个简单的命令
mount.cifs //10.16.0.160/wwwroot /mnt/cm/ -o user=netops
mount.cifs //10.16.0.160/wwwroot /mnt/cm/ -o user=netops
centos will prompt you for the windows username password.
centos 将提示您输入 windows 用户名密码。
you are done.
你完成了。