Samba文件共享服务的实现(3)

[root@hejie ~]# cat >> /etc/samba/smb.conf <<EOF
> [ran]
> comment = ranranwoaini
> path = /opt/ranran
> browseable = yes
> writable = yes
> guest ok = yes
> public = yes
> EOF

4.重启服务

[root@hejie ~]# systemctl restart smb

5.在客户机上查看服务器端有哪些共享资源

[root@hyj ~]# smbclient -L 192.168.56.11 -U 'Bad User'
Enter SAMBA\Bad User's password:    // 这里直接敲回车,不用输入密码
 Sharename Type Comment
 --------- ---- -------
 print$ Disk Printer Drivers
 zhengran Disk zhengranwoaini
 ran Disk ranranwoaini
 IPC$ IPC IPC Service (Samba 4.6.2)
Reconnecting with SMB1 for workgroup listing.

Server Comment
 --------- -------

Workgroup Master
 --------- -------

6.将samba服务器的共享资源ran挂在到客户机上

[root@hyj ~]# mount -t cifs //192.168.56.11/ran /opt/ran -o username='Bad User'
Password for Bad User@//192.168.56.11/ran
[root@hyj ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 17G 1016M 16G 6% /
devtmpfs 982M 0 982M 0% /dev
tmpfs 993M 0 993M 0% /dev/shm
tmpfs 993M 8.5M 984M 1% /run
tmpfs 993M 0 993M 0% /sys/fs/cgroup
/dev/sda1 1014M 125M 890M 13% /boot
tmpfs 199M 0 199M 0% /run/user/0
//192.168.56.11/ran 47G 5.4G 42G 12% /opt/ran

7.在客户机上进入共享目录创建新文件

[root@hyj ~]# cd /opt/ran/
[root@hyj ran]# ls
[root@hyj ran]# touch a b c
[root@hyj ran]# ls
a b c

8.在服务端验证

[root@hejie ~]# cd /opt/ranran/
[root@hejie ranran]# ls
a b c

更多Samba相关教程见以下内容:

CentOS 7.2 安装配置Samba服务器  https://www.linuxidc.com/Linux/2017-03/141390.htm
VMWare 虚拟机 Ubuntu 双网卡 访问 samba 速度 翻倍 https://www.linuxidc.com/Linux/2013-06/85445.htm
samba安装使用图解  https://www.linuxidc.com/Linux/2017-03/141254.htm
CentOS7.2下源码搭建Samba文件服务器[原创] https://www.linuxidc.com/Linux/2017-06/144557.htm
如何在Ubuntu 16.04上安装和配置Samba服务器以进行文件共享  https://www.linuxidc.com/Linux/2017-11/148194.htm
CentOS 7下Samba服务安装与配置详解 https://www.linuxidc.com/Linux/2017-11/148354.htm
Red Hat 6.5 下 Samba服务器搭建 https://www.linuxidc.com/Linux/2017-07/145747.htm
如何在Ubuntu 17.10上使用System-Config-Samba  https://www.linuxidc.com/Linux/2018-01/150493.htm

Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx

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

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