Samba配置
https://wiki.samba.org/index.php/Samba_AD_DC_Port_Usage
安装后开放端口
1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:445
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:139
发现samba可以连接,但没有显示文件列表.
于是google,发现需要设置selinux。
http://danwalsh.livejournal.com/14195.html
setenforce 0 先关闭selinux看是否正常访问,若正常,则是selinux的问题,再开启selinux,设置:
允许home目录共享:
setsebool -P samba_enable_home_dirs 1
特定目录,未测试:
chcon -R -t samba_share_t /var/eng
Reference:
- Confining Samba with SELinux
-
- November 9th, 2007
My next few blogs will be taking different confined domains and writing about the types and booleans related to that domain, I will be updating the man pages for these confined domains. And then showing how the policy for the domain works.samba has had a man page available for some time named samba_selinux, here is my rewrite for Fedora 7/8
> man samba_selinux
samba_selinux(8) Samba Selinux Policy documentation samba_selinux(8)
NAME
samba_selinux - Securing Samba with SELinuxDESCRIPTION
Security-Enhanced Linux secures the Samba server via flexible
mandatory access control. SELinux Samba policy defaults to least
privilege access. Several Booleans and file contexts are available to
customize the way Samba SELinux works.SHARING FILES
SELinux requires files be labeled with an extended attribute to define
the file type. Policy governs the access daemons have to these files.
When sharing files with Samba you have many options on how to label
the files. If you want to share files/directories other than home
directories or standard directory. You should label these
files/directories as samba_share_t. For example if you created the
directory /var/eng, you can label the directory and its contents with
the chcon tool.# chcon -R -t samba_share_t /var/eng
This label will not survive a relabel. A better solution to make the
change permanent, you must tell the SELinux system about the label
customization. The semanage command can customize the default file
contexts on your machine. restorecon will read the file_context and
apply it to the files and directories..# semanage fcontext -a -t samba_share_t ’/var/eng(/.*)?’
# restorecon -R -v /var/engSHARING HOME DIRECTORIES
By default SELinux policy turns off SELinux sharing of home
directories If you are setting up this machine as a Samba
server and wish to share the home directories, you need to set the
samba_enable_home_dirs boolean.# setsebool -P samba_enable_home_dirs 1
SHARING PUBLIC FILES
If you want to share files with multiple domains (Apache, FTP, rsync,
Samba), you can set a file context of public_content_t and
public_content_rw_t. These context allow any of the above domains to
read
the content. If you want a particular domain to write
to the public_content_rw_t domain, you must set the appropriate
boolean. allow_DOMAIN_anon_write. So for samba you would execute:# semanage fcontext -a -t public_content_rw_t ’/var/eng(/.*)?’
# restorecon -R -v /var/eng
# setsebool -P allow_smbd_anon_write 1SHARING FILES SYSTEM FILES
Note: You should not do the above for standard directories or home
directories! For example directories owned by an RPM. If you wanted
to share /usr via Samba, changing its context and all of the sub
directories to samba_share_t would be a bad idea. Other confined
domains would no longer be able to read /usr and this would cause havoc
on the machine. There are two booleans that you can set to allow the
sharing of standard directories. If you want to share any standard
directory read/only you can set the boolean samba_export_all_ro.# setsebool -P samba_export_all_ro 1
This boolean will allow Samba to read every file on the
system.Similarly if you want to share all files and directories via
Samba, you set the samba_export_all_rw# setsebool -P samba_export_all_rw 1
This boolean would allow Samba to read and write every file on your
system. So a compromised Samba server would be very dangerous.SHARING PUBLIC NFS FILES
SELinux prevents the Samba daemons from reading/writing nfs shares by
default. If you are using samba to share NFS file systems you need to
turn on the samba_share_nfs boolean# setsebool -P samba_share_nfs 1
USING CIFS/SAMBA HOME DIRECTORIES
Samba SELinux policy will not allow any confined applications to
access remote samba shares mounted on your machine. If you want to use a
remote Samba server for the home directories on this machine, you must
set the use_samba_home_dirs boolean.# setsebool -P use_samba_home_dirs 1
SAMBA Scripts
Samba can be setup to run user defined scripts, by default if you
install these scripts /var/lib/samba/scripts they will be labeled
samba_unconfined_script_exec_t. Since these scripts can do just
about anything on the system you can run them as unconfined. But you
need to turn on the samba_run_unconfined boolean# setsebool -P samba_run_unconfined 1
If you are willing to write policy an interface exists in
samba.if called samba_helper_template(APP). This interface will
create a file context of samba_APP_script_exec_t, and a domain of
samba_APP_script_t. Samba will transition scripts labeled
samba_app_script_exec_t to samba_APP_script_t, you can then user
audit2allow to write policy to confine your script.USING SAMBA AS A DOMAIN CONTROLLER
If you want to run samba as a domain controller, IE Add machines to the
passwd file on a Linux box, you need to turn on the
samba_domain_controller boolean. This allows the Samba daemon to run
and transition to the passwd, useradd, and groupadd utilities. These
tools can manipulate the passwd database.GUI system-config-selinux
system-config-selinux is a GUI tool available to customize all of the SELinux booleans and file context described above.AUTHOR
This manual page was written by Dan Walsh <dwalsh@redhat.com>.SEE ALSO
selinux(8), semanage(8), samba(7), chcon(1), setsebool(8), restorecon(8),dwalsh@redhat.com 9 Nov 2007 samba_selinux(8)
Samba配置的更多相关文章
- debian下samba配置
debian下samba配置 http://blog.chinaunix.net/uid-2282111-id-2113216.html 服务器端配置过程:1. apt-get install sa ...
- samba配置中常见错误收集.txt
在命令行输入命令: ~$ smbclient -L \\127.0.0.1按要求输入密码后,提示出错:session setup failed: NT_STATUS_LOGON_FAILURE 这是因 ...
- centos samba/squid 配置 samba配置 smbclient mount fstab自动挂载samba curl -xlocalhost:3128 www.qq.com squid配置 3128 DNSPOD 第二十七节课
centos samba/squid 配置 samba配置 smbclient mount fstab自动挂载samba curl -xlocalhost:3128 www.qq.com squ ...
- 通过视频展示如何通过Samba配置PDC
通过视频展示如何通过Samba配置PDC(Linux企业应用案例精解补充视频内容) 本文通过视频,真实地再现了在Linux平台下如何通过配置smb.conf文件而实现Samba Server模拟win ...
- Centos7 samba配置
目录 免密码只读 加密码可读写 Samba配置了很多次,总是忘,现在写在博客里. 免密码只读 最主要的是免密配置,主要用到了两个配置,要写在[global]里: map to guest = Bad ...
- samba 配置参数详解
samba 配置参数详解: 一.全局配置参数 workgroup = WORKGROUP说明:设定 Samba Server 所要加入的工作组或者域. server string = Samba S ...
- 新建samba配置步骤
Linux系统默认已经安装了Samba,但是没有安装Samba服务: 1,先查看安装情况:rpm -qa|grep samba 根据系统的安装情况选择下载或者通过光驱安装所缺的rpm包. 我的安装情况 ...
- (转)Ubuntu samba配置服务文件包
转:http://os.51cto.com/art/201001/176366.htm Ubuntu samba服务配置是很不错的文件应用很有学习价值,这里我主要讲解Ubuntu samba服务配置的 ...
- Linux samba配置
更详细的配置地址:http://www.cnblogs.com/mchina/archive/2012/12/18/2816717.html 1 安装 yum -y install samba 2 ...
- samba配置只读共享
编辑smb.conf 1.在[global]中 找到 security = 将其改为 security = share 2. 在文件中加入自定义的共享目录 [attachment] path=/dat ...
随机推荐
- memcache/redis 缓存学习笔记
0.redis和memcache的区别 a.redis可以存储除了string之外的对象,如list,hash等 b.服务器宕机以后,redis会把内存的数据持久化到磁盘上,而memcache则不会 ...
- BZOJ1012[JSOI2008]最大数maxnumber 题解
题目大意: 维护一个数列,有两种操作:1. 查询当前数列中末尾L个数中的最大的数,并输出这个数的值.限制:L不超过当前数列的长度.2.插入操作:将n加上t,其中t是最近一次查询操作的答案(如果还未执行 ...
- 百度mobile UI组件GMU demo学习1-结构和初始化
移动web现在已经是zepto的天下,但是一直找不到合适UI库,找了一段时间,终于找到了百度的ui库gum和inter 的 appframework UI库 相比之下,百度的UI库更接地气,配合百度强 ...
- 【BZOJ】2086: [Poi2010]Blocks
题意 \(n(1 \le n \le 1000000)\)个数\(a_i(a_i \le 10^9)\).\(m(1 \le m \le 50)\)次询问,每次给出一个\(k(k \le 10^9)\ ...
- 【CodeVS】p1174 靶形数独
题目描述 Description 小城和小华都是热爱数学的好学生,最近,他们不约而同地迷上了数独游戏,好胜的他们想用数独来一比高低.但普通的数独对他们来说都过于简单了,于是他们向Z 博士请教,Z 博士 ...
- 【BZOJ4260】 Codechef REBXOR 可持久化Trie
看到异或就去想前缀和(⊙o⊙) 这个就是正反做一遍最大异或和更新答案 最大异或就是很经典的可持久化Trie,从高到低贪心 WA: val&(1<<(base-1))得到的并不直接是 ...
- BZOJ4491: 我也不知道题目名字是什么
Description 给定一个序列A[i],每次询问l,r,求[l,r]内最长子串,使得该子串为不上升子串或不下降子串 Input 第一行n,表示A数组有多少元素接下来一行为n个整数A[i]接下来一 ...
- JS设置CSS样式的几种方式【转】
用JS来动态设置CSS样式,常见的有以下几种 1. 直接设置style的属性 某些情况用这个设置 !important值无效 如果属性有'-'号,就写成驼峰的形式(如textAlign) 如果想保 ...
- 关于Go,你可能不注意的7件事(转的)
http://tonybai.com/2015/09/17/7-things-you-may-not-pay-attation-to-in-go/ code https://github.com/bi ...
- js获取屏幕大小
1.js获取屏幕大小 <html> <script> function a(){ document.write( "屏幕分辨率为:"+screen.widt ...