[英]Shell script to mount windows network location in linux machine
I have two questions here. 我在这里有两个问题。 I am able to mount a windows network path in my Ubuntu machine by doing following:
通过执行以下操作,我可以在Ubuntu计算机中挂载Windows网络路径:
sudo mount -t cifs -o username=user \\\\my_windows\\test /net/loc
All the files and folders present in Windows machine is now available in Ubuntu machine with path '/net/loc'. Windows机器中存在的所有文件和文件夹现在都可以在Ubuntu机器中使用路径“ / net / loc”使用。
Here are my doubts: 这是我的疑问:
I can see all files of windows in linux path. 我可以在linux路径中看到Windows的所有文件。 Is it possible to create files/folders in Linux path(the mount path where windows path is mounted) and it will be reflected in Windows machine?
是否可以在Linux路径(安装Windows路径的安装路径)中创建文件/文件夹,并将其反映在Windows计算机中? I am not able to write in Linux machine where windows network location is mounted.
我无法在装有Windows网络位置的Linux机器上写东西。 It throws me error "Can't open file for writing".
它引发我错误“无法打开文件进行写入”。
I am trying to write a shell script (a ksh file) which will mount the windows network path. 我正在尝试编写一个将挂载Windows网络路径的Shell脚本(一个ksh文件)。 I wrote the below mount command in my file but this command prompts for password.
我在文件中写入了以下mount命令,但该命令提示输入密码。 Is there any way, I can write the command in shell script that it will not ask me for password and I can pass it as either as a parameter or some other mechanism?
有什么办法,我可以用shell脚本写命令,它不会询问我密码,我可以将它作为参数或其他机制传递给我?
mount -t cifs -o username=user \\\\my_windows\\test /net/loc mount -t cifs -o username = user \\\\ my_windows \\ test / net / loc
Thank you 谢谢
Password can be passed as below 密码可以通过以下方式传递
sudo mount -t cifs -o username=${USER},password=${PASSWORD},uid=,gid= //server-address/folder /mount/path/on/ubuntu sudo mount -t cifs -o username = $ {USER},password = $ {PASSWORD},uid =,gid = //服务器地址/文件夹/ mount / path / on / ubuntu
And with root access I am able to write in Linux path. 通过root访问,我可以在Linux路径中编写。
More information is here https://unix.stackexchange.com/questions/68079/mount-cifs-network-drive-write-permissions-and-chown 更多信息在这里https://unix.stackexchange.com/questions/68079/mount-cifs-network-drive-write-permissions-and-chown
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.