Linux基础知识 vsftpd,samba服务器侧写配置详解(3)

测试:挂载前可以使用smbclient -L //192.168.100.20 -U zhangsan%123 命令来查看共享状态
[root@server ~]# mkdir /zhang
[root@server ~]# mkdir /li
[root@server ~]# mkdir /wang
[root@server ~]# mount -t cifs -o username=zhangsan,password=123 //192.168.100.20/shared /zhang/   //用户zhangsan挂载
[root@server ~]# mount -t cifs -o username=lisi,password=123 //192.168.100.20/shared /li         //用户lisi挂载
[root@server ~]# mount -t cifs -o username=wangwu,password=123 //192.168.100.20/shared /wang    //用户wangwu挂载,出现权限问题
mount error 13 = Permission denied
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)

[root@server ~]# df -h   //挂载后的状态,以上实现了要求的一半,除了wangwu外,另外两个用户可以访问shared共享
Filesystem            Size Used Avail Use% Mounted on
/dev/hda2              38G 1.3G   35G   4% /
/dev/hda1              99M   12M   83M 12% /boot
tmpfs                  80M     0   80M   0% /dev/shm
/dev/hdc              2.8G 2.8G     0 100% /mnt
//192.168.100.20/shared
                       38G 1.3G   35G   4% /zhang
//192.168.100.20/shared
                       38G 1.3G   35G   4% /li

[root@server ~]# mkdir /zhanghome   //两个用户分别挂载自己的共享家目录
[root@server ~]# mkdir /lihome
[root@server ~]# mount -t cifs -o username=zhangsan,password=123 //192.168.100.20/zhangsan /zhanghome/
[root@server ~]# mount -t cifs -o username=lisi,password=123 //192.168.100.20/lisi /lihome/

[root@server ~]# df -h   //查看挂载
Filesystem            Size Used Avail Use% Mounted on
/dev/hda2              38G 1.3G   35G   4% /
/dev/hda1              99M   12M   83M 12% /boot
tmpfs                  80M     0   80M   0% /dev/shm
/dev/hdc              2.8G 2.8G     0 100% /mnt
//192.168.100.20/shared
                       38G 1.3G   35G   4% /zhang
//192.168.100.20/shared
                       38G 1.3G   35G   4% /li
//192.168.100.20/zhangsan
                       38G 1.3G   35G   4% /zhanghome
//192.168.100.20/lisi
                       38G 1.3G   35G   4% /lihome

[root@server ~]# cd /zhanghome/ //zhangsan用户在自己的家目录下创建一个文件,并将此文件复制到前面挂载的/zhang目录下
[root@server zhanghome]# ls
[root@server zhanghome]# cat > test.txt <<EOF
> if you see this information in shared directory,
> the exam has pass
> good luck for you........
> EOF
[root@server zhanghome]# cp test.txt /zhang

[root@server zhanghome]# cd /li //在lisi用户挂载的目录中能看到该文件,且权限正确
[root@server li]# ll
total 8
-rwxr--r-- 1 zhangsan sharedgroup 93 Mar 25 02:31 test.txt
[root@server li]# cat test.txt
if you see this information in shared directory,
the exam has pass
good luck for you........

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/27275.html