我可以使用 mount.cifs 和 fstab Entrye 然后 mount -a 从 Raspberry/Jessie 成功通过网络挂载 Windows 共享。
例如sudo mount.cifs //HPSERVER/linux-bup/ /home/maxg/bmsOnSrvr -v -o user=linux,pass=****
但是,当我想写入该 Windows 共享时,我的权限被拒绝。我可以读取共享上的文件。
这是我在linux机器上看到的:
# [2018-04-17 21:13] maxg@rpi32 ~/bmsOnSrvr $
la
total 5
drwxr-xr-x 2 root root 0 Apr 17 21:04 .
drwxr-xr-x 8 maxg maxg 4096 Apr 17 19:15 ..
-rwxr-xr-x 1 root root 4 Apr 17 21:04 deleteme.txt
-rwxr-xr-x 1 root root 0 Apr 8 11:50 desktop.ini
drwxr-xr-x 2 root root 0 Apr 17 19:15 rPi32
Windows 共享允许用户“linux”完全访问,如使用 CACLS 所示:
C:\>cacls d:\shares\linux-bup
d:\shares\linux-bup BUILTIN\Administrators:(OI)(CI)F
CREATOR OWNER:(OI)(CI)(IO)F
Everyone:(OI)(CI)F
HPSERVER\linux:(OI)(CI)F
NT AUTHORITY\SYSTEM:(OI)(CI)F
C:\>cacls d:\shares\linux-bup\rPi32
d:\shares\linux-bup\rPi32 BUILTIN\Administrators:(OI)(CI)F
CREATOR OWNER:(OI)(CI)(IO)F
Everyone:(OI)(CI)F
HPSERVER\linux:(OI)(CI)F
NT AUTHORITY\SYSTEM:(OI)(CI)F
D:\shares\linux-bup>echo . >deleteme.txt
D:\shares\linux-bup>cacls d:\shares\linux-bup\deleteme.txt
d:\shares\linux-bup\deleteme.txt BUILTIN\Administrators:F
Everyone:F
HPSERVER\linux:F
NT AUTHORITY\SYSTEM:F
我不知道为什么我无法访问。我还需要什么才能获得访问权限?
答案1
进一步挖掘发现了一个noperm
可以在 mount 命令上使用的参数:
sudo mount.cifs //HPSERVER/linux-bup/ /home/maxg/bmsOnSrvr --v -o user=linux,pass=****,noperm
现在结果:
# [2018-04-17 21:45] maxg@rpi32 ~/bmsOnSrvr $
la
total 5
drwxr-xr-x 2 root root 0 Apr 17 21:04 .
drwxr-xr-x 8 maxg maxg 4096 Apr 17 19:15 ..
-rwxr-xr-x 1 root root 4 Apr 17 21:04 deleteme.txt
-rwxr-xr-x 1 root root 0 Apr 8 11:50 desktop.ini
drwxr-xr-x 2 root root 0 Apr 17 19:15 rPi32
# [2018-04-17 21:45] maxg@rpi32 ~/bmsOnSrvr $
echo kjskjs>max.txt
# [2018-04-17 21:45] maxg@rpi32 ~/bmsOnSrvr $
rm desktop.ini
# [2018-04-17 21:45] maxg@rpi32 ~/bmsOnSrvr $
la
total 5
drwxr-xr-x 2 root root 0 Apr 17 2018 .
drwxr-xr-x 8 maxg maxg 4096 Apr 17 19:15 ..
-rwxr-xr-x 1 root root 4 Apr 17 21:04 deleteme.txt
-rwxr-xr-x 1 root root 7 Apr 17 21:45 max.txt
drwxr-xr-x 2 root root 0 Apr 17 19:15 rPi32
[编辑]但是,看起来这是正确的方法:
sudo mount.cifs //HPSERVER/linux-bup/ /home/maxg/bmsOnSrvr --v -o user=linux,pass=****,uid=1001,gid=1001
现在结果:
# [2018-04-17 21:59] maxg@rpi32 ~/bmsOnSrvr $
la
total 4
drwxr-xr-x 2 maxg maxg 0 Apr 17 21:50 .
drwxr-xr-x 8 maxg maxg 4096 Apr 17 19:15 ..
drwxr-xr-x 2 maxg maxg 0 Apr 17 19:15 rPi32
# [2018-04-17 21:59] maxg@rpi32 ~/bmsOnSrvr $
echo crap>crap.txt
# [2018-04-17 21:59] maxg@rpi32 ~/bmsOnSrvr $
la
total 5
drwxr-xr-x 2 maxg maxg 0 Apr 17 22:00 .
drwxr-xr-x 8 maxg maxg 4096 Apr 17 19:15 ..
-rwxr-xr-x 1 maxg maxg 5 Apr 17 21:59 crap.txt
drwxr-xr-x 2 maxg maxg 0 Apr 17 19:15 rPi32
答案2
安装后 root 成为驱动器所有者。因此,在安装时我们必须使用uid
参数gid
来分配特定的用户和组。
以下命令应该可以完成您的工作。
sudo mount.cifs //HPSERVER/linux-bup/ /home/maxg/bmsOnSrvr --v -o user=linux,pass=****,uid=1001,gid=1001