samba远程访问配置

2020-12-18 13:06
63
0

可能需要关闭 selinux

#临时关闭 重启失效
setenforce 0

永久关闭重启生效
sudo vim /etc/sysconfig/selinux
SELINUX=disabled

 

创建smb用户

# 添加linux账户
adduser username

#添加对应smb账户
smbpasswd -a username

 

sudo vim /etc/samba/smb.conf

自己看注释慢慢研究

# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.

[global]

	#工作组
	workgroup = WORKGROUP

	#安全模式用户 允许匿名 默认 nobody
	security = user
	map to guest = Bad User
	guest account = nobody

        #wins 服务
        wins support = yes
        local master = yes
        prefered master = yes
        domain master = yes 
        os level = 99
	#Samba Server 的注释
	#server string = 局域网服务器%v

	#windwos访问时候的主机名字
	netbios name = Server

	#用户后台 设置密码认证的方式
	passdb backend = tdbsam

	#日志文件
	log file = /tmp/smb_%m.log.txt

	#日志大小 kb
	max log size = 10240

	#nmdb成为windows客户端的时间服务器
	time server = yes


[data]

	#共享描述,任意字符串
	comment = 数据,仅ROOT管理员

	path = /data

	#允许的用户
	valid users = root,nobody
    guest ok = yes
	#允许写入的用户
	write list = root,nobody

	#是否允许浏览
	browseable = no

	#只读
	read only = yes

	inherit acls = Yes

[webapps]

	#共享描述,任意字符串
	comment = WEB容器,仅ROOT管理员

	path = /opt/tomcat/webapps

	#允许的用户
	valid users = root

	#允许写入的用户
	write list = root

	#是否允许浏览
	browseable = no

	#只读
	read only = yes

	inherit acls = Yes

[音乐(只读)]
	#共享描述,任意字符串
	comment = 媒体,允许所有人读取

	path = /data/Media/Music

	#允许的用户
	valid users = root,nobody

	#允许写入的用户
	write list =

	#是否允许浏览
	browseable = yes

	guest ok = yes
		
	#只读
	read only = yes

	inherit acls = Yes

[视频(只读)]
	#共享描述,任意字符串
	comment = 媒体,允许所有人读取

	path = /data/Media/Video

	#允许的用户
	valid users = root,nobody

	#允许写入的用户
	write list =

	#是否允许浏览
	browseable = yes

	guest ok = yes
		
	#只读
	read only = yes

	inherit acls = Yes

#[共享目录]
[Share]
	#共享描述,任意字符串
	comment = 默认,所有人读取编辑

	path = /data/Share/

	#允许的用户
	valid users = root,nobody

	#允许写入的用户
	write list = root,nobody

	#是否允许浏览
	browseable = yes
        
	guest ok = yes 
	
	#只读
	read only = yes

	inherit acls = Yes

全部评论