手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux基本知识点总结——Samba

[日期:2013-05-29] 来源:Linux社区  作者:Linux [字体:大 中 小]

三、将共享文件加载到客户端本地进行操作

 

1.使用it1登录、挂载,创建文件(夹)

[root@zoro ~]# mount -t cifs 192.168.56.53:/it /mnt/ -o username=it1%RedHat

[root@zoro ~]# cd /mnt

[root@zoro mnt]# mkdir it01

[root@zoro mnt]# vim it01/a

this is file a (注,这个是输入的内容)

[root@zoro mnt]# ls -ld it01/

drwxr-x--- 2 504 506 0 May 27 06:35 it01/

[root@zoro mnt]# ls -ll it01/

total 4

-rw-r----- 1 504 506 15 May 27 06:35 a

[root@zoro mnt]# cd

[root@zoro ~]# umount -t cifs 192.168.56.53:/it /mnt/

umount: /mnt: not mounted

 

注:由于在配置文件中,对/it的共享设置,指定了create mask = 640和directory mask = 750,所以创建的文件和文件夹,都是用户组成员有读(执行)权限,其他人没有任何读写权限。

 

另外,由于/it的共享设置里有group = it这一行,it1无论是创建文件或文件夹,其所属用户组都是it1(504)所在的用户组it(506)。这里因为是远程挂载的,使用ll命令只能看到用户id。

 

下面使用it2访问时,由于it2也在it组里,所以it2对文件夹it01的r-x权限,对文件a有r--权限。

 

2.使用it2登录、挂载,进行验证

[root@zoro ~]# mount -t cifs 192.168.56.53:/it /mnt/ -o username=it2%redhat

[root@zoro ~]# cd /mnt

[root@zoro mnt]# ls

it01

[root@zoro mnt]# ls it01/

a

[root@zoro mnt]# cat it01/a

this is file a

[root@zoro mnt]# rm -rf it01

rm: cannot remove `it01/a': Permission denied

[root@zoro mnt]# rm -rf it01/a

rm: cannot remove `it01/a': Permission denied

[root@zoro mnt]# touch it01/b

touch: cannot touch `it01/b': Permission denied

 

以上可以看出,it2可以读it1的文件(夹),但却没有权限删除和修改(使用vim编辑it01/a时,会被提示不能修改)。

 

在上述配置文件中,如果对/it的共享设置,指定了create mask = 640和directory mask = 750,却没有添加group = it,那么it1创建的文件和文件夹,其用户组都是it1,此时it2属于其他人,是没有读写权限的。

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款