1、需求:

非root用户(普通用户)能够读写windows共享目录,比如查看文件、创建文件、修改文件、删除文件

# 让普通用户也可以正常读写

uid=value and gid=value

Set the owner and group of the root of the file system (default: uid=gid=0, but with option uid or gid without specified value, the uid and gid of the current process are taken).

2、挂载步骤

先在 Windows 下面共享需要挂载的目录

指定需要共享的文件目录:Downloads

右键》共享》网络文件和文件夹共享》共享…》选择要与其共享的用户》默认用户即可

右键》共享》高级共享》高级共享…》勾选共享些文件夹

右键》共享》高级共享》高级共享…》权限》为指定用户赋予完全控制权限

3、在linux普通用户下,创建挂载与windows共享一一对应的挂载目录

mkdir -p ~/windows-downloads

4、查看当前用户uid和gid

cat /etc/passwd |grep xxx

cat /etc/group|grep users

5、挂载命令

sudo mount -t cifs -o uid=1000,gid=100,username=xxx,password=xxxxxx

//10.239.15.119/Users/xxx/Downloads /home/xxx/windows-downloads

6、查挂载在状态

# df -h

文件系统 容量 已用 可用 已用% 挂载点

//x.x.x.x/Users/xxx/Downloads 466G 58G 408G 13% /home/xxx/windows-downloads

相关阅读

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。