Samba服务器的配置

来自CloudWiki
跳转至: 导航搜索

配置文件的备份

思考:samba服务器的配置文件是什么 ?

 207  cd /etc/samba/
 208  ls
 210  mv smb.conf smb.conf.bak
 211  ls
 212  grep -v "#" /etc/samba/smb.conf.bak > /etc/samba/smb.conf
 213  vi /etc/samba/smb.conf

配置Share级Samba服务器

思考,share是samba默认的安全级别吗 ?samba默认的安全级别是什么 ?

编辑全局设置部分

[global]

        workgroup = Linux
       ...
       
        security = share
;       passdb backend = tdbsam(注意前面应该有个分号)
 
       #设置Samba服务器的安全级别为share

编辑共享定义部分

在共享定义部分添加以下内容:


[html]
        comment = Temporary file space
        path = /var/www/html
        read only = no
        public = yes


测试配置文件的正确性

每次编辑完smb.conf的配置文件后,都应执行testparm来测试语法是否正确

[root@maxin samba]# testparm

Load smb config files from /etc/samba/smb.conf
rlimit_max: rlimit_max (1024) below minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[html]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
        workgroup = LINUX
        server string = Samba Server Version %v
        security = SHARE
        log file = /var/log/samba/log.%m
        max log size = 50
        cups options = raw

[homes]
        comment = Home Directories
        read only = No
        browseable = No

[printers]
        comment = All Printers
        path = /var/spool/samba
        printable = Yes
        browseable = No

[html]
        comment = Temporary file space
        path = /var/www/html
        read only = No
        guest ok = Yes


配置User级服务

思考:要禁用samba某个用户账号,可以用什么命令 ?

重启samba服务

[root@maxin samba]# service smb restart

Shutting down SMB services:                                [  OK  ]
Starting SMB services:                                     [  OK  ]

Windows10客户端的配置

在文件管理器输入地址栏:\\10.0.0.3 即可.

Linux9-15.png

(图片中的文件仅供参考,具体请以题目要求为准).

如果遇到问题,可参考以下文章解决:

https://baijiahao.baidu.com/s?id=1592008164854725188&wfr=spider&for=pc

如果虚拟机中也安了apache服务器的话,可以通过这种方法把自己的网页文件拷贝到虚拟机html目录中

Linux9-16.png

确保apache服务开启的情况下,用物理机的浏览器访问刚刚上传的网页:

Linux9-13.png