Shell脚本在linux机器上挂载windows网络位置

时间:2017-04-02 16:41:54

标签: linux shell window mount cifs

我在这里有两个问题。我可以通过以下方式在我的Ubuntu机器上安装Windows网络路径:

sudo mount -t cifs -o username=user \\\\my_windows\\test /net/loc

Windows机器中存在的所有文件和文件夹现在都可以在Ubuntu机器上使用路径' / net / loc'。

以下是我的疑惑:

  1. 我可以在linux路径中看到所有windows文件。是否可以在Linux路径(安装Windows路径的安装路径)中创建文件/文件夹,它将反映在Windows机器中?我无法在装有Windows网络位置的Linux机器上编写。它会引发我的错误"无法打开文件进行写作"。

  2. 我正在尝试编写一个将安装Windows网络路径的shell脚本(一个ksh文件)。我在我的文件中写了下面的mount命令,但是这个命令会提示输入密码。有没有办法,我可以在shell脚本中编写命令,它不会要求我输入密码,我可以将其作为参数或其他机制传递?

    mount -t cifs -o username = user \\ my_windows \ test / net / loc

  3. 谢谢

1 个答案:

答案 0 :(得分:0)

密码可以如下传递

sudo mount -t cifs -o username = $ {USER},password = $ {PASSWORD},uid =,gid = // server-address / folder / mount / path / on / ubuntu

使用root访问权限,我可以在Linux路径中编写。

更多信息请访问https://unix.stackexchange.com/questions/68079/mount-cifs-network-drive-write-permissions-and-chown