【Fedora20】 samba配置

From: http://blog.163.com/shi_shun/blog/static/23707849201452641312640/

1、安装前的准备

关闭防火墙    //不关的后果是windows看不到本机

systemctl stop firewalld        //暂时关闭防火墙

systemctl disable firewalld    //开机禁止启动


关闭selinux    //不关的后果是windows没有权限访问本机

setenforce 0        //暂时禁用selinux

编辑 /etc/selinux/config        //永久禁用selinux

我的做法如图(我的桌面环境是Mate, ver1.8, 跟Gnome2很像吧,一定是亲戚关系吧大笑):

 

通过这样的配置后,防火墙不关也可以了!SELinux好厉害呀,不关掉,windows怎么也访问不了!修改/etc/selinux/config如下:

[zcm@vm-fedora20 selinux]$ cat config 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

 

2、安装samba

yum install samba    //服务器,客户端工具默认会装上的,所以不需要执行yum install samba-client了


3、配置samba

编辑 /etc/samba/smb.conf,我是修改了“workgroup = WORKGROUP",并在结尾加上:

[program]
comment = zcm program dictory
path = /home/zcm/program
public = yes
writable = yes
valid users = zcm
create mask = 0700
directory mask = 0700
browseable = yes


 这个就是我共享的目录了,要保证这个目录存在噢,否则samba访问时将失败!


4、添加用户

# smbpasswd -a USER     //添加USER用户


5、启动samba服务

service smb start

 

再通过windows来访问samba,验证下你的成果!

 

======================================================================

下面是我完整的smb.conf文件内容:

# This is the main Samba configuration file. For detailed information about the
# options listed here, refer to the smb.conf(5) manual page. Samba has a huge
# number of configurable options, most of which are not shown in this example.
#
# The Official Samba 3.2.x HOWTO and Reference Guide contains step-by-step
# guides for installing, configuring, and using Samba:
# http://www.samba.org/samba/docs/Samba-HOWTO-Collection.pdf
#
# The Samba-3 by Example guide has working examples for smb.conf. This guide is
# generated daily: http://www.samba.org/samba/docs/Samba-Guide.pdf
#
# In this file, lines starting with a semicolon (;) or a hash (#) are
# comments and are ignored. This file uses hashes to denote commentary and
# semicolons for parts of the file you may wish to configure.
#
# Note: Run the "testparm" command after modifying this file to check for basic
# syntax errors.
#
#---------------
# Security-Enhanced Linux (SELinux) Notes:
#
# Turn the samba_domain_controller Boolean on to allow Samba to use the useradd
# and groupadd family of binaries. Run the following command as the root user to
# turn this Boolean on:
# setsebool -P samba_domain_controller on
#
# Turn the samba_enable_home_dirs Boolean on if you want to share home
# directories via Samba. Run the following command as the root user to turn this
# Boolean on:
# setsebool -P samba_enable_home_dirs on
#
# If you create a new directory, such as a new top-level directory, label it
# with samba_share_t so that SELinux allows Samba to read and write to it. Do
# not label system directories, such as /etc/ and /home/, with samba_share_t, as
# such directories should already have an SELinux label.
#
# Run the "ls -ldZ /path/to/directory" command to view the current SELinux
# label for a given directory.
#
# Set SELinux labels only on files and directories you have created. Use the
# chcon command to temporarily change a label:
# chcon -t samba_share_t /path/to/directory
#
# Changes made via chcon are lost when the file system is relabeled or commands
# such as restorecon are run.
#
# Use the samba_export_all_ro or samba_export_all_rw Boolean to share system
# directories. To share such directories and only allow read-only permissions:
# setsebool -P samba_export_all_ro on
# To share such directories and allow read and write permissions:
# setsebool -P samba_export_all_rw on
#
# To run scripts (preexec/root prexec/print command/...), copy them to the
# /var/lib/samba/scripts/ directory so that SELinux will allow smbd to run them.
# Note that if you move the scripts to /var/lib/samba/scripts/, they retain
# their existing SELinux labels, which may be labels that SELinux does not allow
# smbd to run. Copying the scripts will result in the correct SELinux labels.
# Run the "restorecon -R -v /var/lib/samba/scripts" command as the root user to
# apply the correct SELinux labels to these files.
#
#--------------
#
#======================= Global Settings =====================================
[global]
# ----------------------- Network-Related Options -------------------------
#
# workgroup = the Windows NT domain name or workgroup name, for example, MYGROUP.
#
# server string = the equivalent of the Windows NT Description field.
#
# netbios name = used to specify a server name that is not tied to the hostname.
#
# interfaces = used to configure Samba to listen on multiple network interfaces.
# If you have multiple interfaces, you can use the "interfaces =" option to
# configure which of those interfaces Samba listens on. Never omit the localhost
# interface (lo).
#
# hosts allow = the hosts allowed to connect. This option can also be used on a
# per-share basis.
#
# hosts deny = the hosts not allowed to connect. This option can also be used on
# a per-share basis.
#
# max protocol = used to define the supported protocol. The default is NT1. You
# can set it to SMB2 if you want experimental SMB2 support.
#
workgroup = WORKGROUP
server string = Samba Server Version %v
;	netbios name = MYSERVER
;	interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24
;	hosts allow = 127. 192.168.12. 192.168.13.
;	max protocol = SMB2
# --------------------------- Logging Options -----------------------------
#
# log file = specify where log files are written to and how they are split.
#
# max log size = specify the maximum size log files are allowed to reach. Log
# files are rotated when they reach the size specified with "max log size".
#
# log files split per-machine:
log file = /var/log/samba/log.%m
# maximum size of 50KB per log file, then rotate:
max log size = 50
# ----------------------- Standalone Server Options ------------------------
#
# security = the mode Samba runs in. This can be set to user, share
# (deprecated), or server (deprecated).
#
# passdb backend = the backend used to store user information in. New
# installations should use either tdbsam or ldapsam. No additional configuration
# is required for tdbsam. The "smbpasswd" utility is available for backwards
# compatibility.
#
security = user
passdb backend = tdbsam
# ----------------------- Domain Members Options ------------------------
#
# security = must be set to domain or ads.
#
# passdb backend = the backend used to store user information in. New
# installations should use either tdbsam or ldapsam. No additional configuration
# is required for tdbsam. The "smbpasswd" utility is available for backwards
# compatibility.
#
# realm = only use the realm option when the "security = ads" option is set.
# The realm option specifies the Active Directory realm the host is a part of.
#
# password server = only use this option when the "security = server"
# option is set, or if you cannot use DNS to locate a Domain Controller. The
# argument list can include My_PDC_Name, [My_BDC_Name], and [My_Next_BDC_Name]:
#
# password server = My_PDC_Name [My_BDC_Name] [My_Next_BDC_Name]
#
# Use "password server = *" to automatically locate Domain Controllers.
;	security = domain
;	passdb backend = tdbsam
;	realm = MY_REALM
;	password server = <NT-Server-Name>
# ----------------------- Domain Controller Options ------------------------
#
# security = must be set to user for domain controllers.
#
# passdb backend = the backend used to store user information in. New
# installations should use either tdbsam or ldapsam. No additional configuration
# is required for tdbsam. The "smbpasswd" utility is available for backwards
# compatibility.
#
# domain master = specifies Samba to be the Domain Master Browser, allowing
# Samba to collate browse lists between subnets. Do not use the "domain master"
# option if you already have a Windows NT domain controller performing this task.
#
# domain logons = allows Samba to provide a network logon service for Windows
# workstations.
#
# logon script = specifies a script to run at login time on the client. These
# scripts must be provided in a share named NETLOGON.
#
# logon path = specifies (with a UNC path) where user profiles are stored.
#
#
;	security = user
;	passdb backend = tdbsam
;	domain master = yes
;	domain logons = yes
# the following login script name is determined by the machine name
# (%m):
;	logon script = %m.bat
# the following login script name is determined by the UNIX user used:
;	logon script = %u.bat
;	logon path = \\%L\Profiles\%u
# use an empty path to disable profile support:
;	logon path =
# various scripts can be used on a domain controller or a stand-alone
# machine to add or delete corresponding UNIX accounts:
;	add user script = /usr/sbin/useradd "%u" -n -g users
;	add group script = /usr/sbin/groupadd "%g"
;	add machine script = /usr/sbin/useradd -n -c "Workstation (%u)" -M -d /nohome -s /bin/false "%u"
;	delete user script = /usr/sbin/userdel "%u"
;	delete user from group script = /usr/sbin/userdel "%u" "%g"
;	delete group script = /usr/sbin/groupdel "%g"
# ----------------------- Browser Control Options ----------------------------
#
# local master = when set to no, Samba does not become the master browser on
# your network. When set to yes, normal election rules apply.
#
# os level = determines the precedence the server has in master browser
# elections. The default value should be reasonable.
#
# preferred master = when set to yes, Samba forces a local browser election at
# start up (and gives itself a slightly higher chance of winning the election).
#
;	local master = no
;	os level = 33
;	preferred master = yes
#----------------------------- Name Resolution -------------------------------
#
# This section details the support for the Windows Internet Name Service (WINS).
#
# Note: Samba can be either a WINS server or a WINS client, but not both.
#
# wins support = when set to yes, the NMBD component of Samba enables its WINS
# server.
#
# wins server = tells the NMBD component of Samba to be a WINS client.
#
# wins proxy = when set to yes, Samba answers name resolution queries on behalf
# of a non WINS capable client. For this to work, there must be at least one
# WINS server on the network. The default is no.
#
# dns proxy = when set to yes, Samba attempts to resolve NetBIOS names via DNS
# nslookups.
;	wins support = yes
;	wins server = w.x.y.z
;	wins proxy = yes
;	dns proxy = yes
# --------------------------- Printing Options -----------------------------
#
# The options in this section allow you to configure a non-default printing
# system.
#
# load printers = when set you yes, the list of printers is automatically
# loaded, rather than setting them up individually.
#
# cups options = allows you to pass options to the CUPS library. Setting this
# option to raw, for example, allows you to use drivers on your Windows clients.
#
# printcap name = used to specify an alternative printcap file.
#
load printers = yes
cups options = raw
;	printcap name = /etc/printcap
# obtain a list of printers automatically on UNIX System V systems:
;	printcap name = lpstat
;	printing = cups
# --------------------------- File System Options ---------------------------
#
# The options in this section can be un-commented if the file system supports
# extended attributes, and those attributes are enabled (usually via the
# "user_xattr" mount option). These options allow the administrator to specify
# that DOS attributes are stored in extended attributes and also make sure that
# Samba does not change the permission bits.
#
# Note: These options can be used on a per-share basis. Setting them globally
# (in the [global] section) makes them the default for all shares.
;	map archive = no
;	map hidden = no
;	map read only = no
;	map system = no
;	store dos attributes = yes
#============================ Share Definitions ==============================
;[homes]
;	comment = Home Directories
;	browseable = yes
;	writable = yes
;	valid users = %S
;	valid users = MYDOMAIN\%S
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes
# Un-comment the following and create the netlogon directory for Domain Logons:
;	[netlogon]
;	comment = Network Logon Service
;	path = /var/lib/samba/netlogon
;	guest ok = yes
;	writable = no
;	share modes = no
# Un-comment the following to provide a specific roving profile share.
# The default is to use the user's home directory:
;	[Profiles]
;	path = /var/lib/samba/profiles
;	browseable = no
;	guest ok = yes
# A publicly accessible directory that is read only, except for users in the
# "staff" group (which have write permissions):
;	[public]
;	comment = Public Stuff
;	path = /home/samba
;	public = yes
;	writable = yes
;	printable = no
;	write list = +staff
[program]
comment = zcm program dictory
path = /home/zcm/program
public = yes
writable = yes
valid users = zcm
create mask = 0700
directory mask = 0700
browseable = yes


 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/403928.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【操作系统】实验二 作业调度模拟程序

一、目的和要求 1. 实验目的 &#xff08;1&#xff09;加深对作业调度算法的理解&#xff1b; &#xff08;2&#xff09;进行程序设计的训练。 2&#xff0e;实验要求 用高级语言编写一个或多个作业调度的模拟程序。 单道批处理系统的作业调度程序。作业一投入运行&#xff0…

Nuc972使用NandFlash时,uboot所需要的改动

先贴错误现象。 做工程&#xff0c;我发现&#xff0c;就应该里面记录下来&#xff0c;哪怕再简单&#xff0c;一两个月后&#xff0c;果断忘&#xff0c;最不能相信自己的脑子。不好使~~~~

手把手教你用Python爬虫煎蛋妹纸海量图片

我们的目标是用爬虫来干一件略污事情 最近听说煎蛋上有好多可爱的妹子&#xff0c;而且爬虫从妹子图抓起练手最好&#xff0c;毕竟动力大嘛。而且现在网络上的妹子很黄很暴力&#xff0c;一下接受太多容易营养不量&#xff0c;但是本着有人身体就比较好的套路&#xff0c;特意分…

chrome浏览器的跨域设置,前端修改跨域问题

原文&#xff1a;https://www.cnblogs.com/laden666666/p/5544572.html 做前后分离的webapp开发的时候&#xff0c;出于一些原因往往需要将浏览器设置成支持跨域的模式&#xff0c;好在chrome浏览器就是支持可跨域的设置&#xff0c;网上也有很多chrome跨域设置教程。但是新版本…

Server 2012 Hyper-v新功能之二:自动化支持技术

Server 2012 Hyper-v新功能之一&#xff1a;客户端 Hyper-V Windows PowerShell 是在 Windows Server 中执行自动化任务的脚本解决方案&#xff0c;新的适用于 Windows PowerShell 的 Hyper-V cmdlet 为 IT 专业人员提供了一种简单的方法&#xff0c;能够在 Windows Server 201…

SecureCRTSecureFX_HH_x64_7.0.0.326 crt部署项目到服务器

1.使用crt 2.输入服务器ip和账号 3.命令 cd 空格 /item/qd 回车进入到规定好的前端代码目录下 ls 查看目录下的文件 4.rm -rf 文件名称/或者目录名称&#xff08;空格删除多个、&#xff09; rm 空格 -rf 空格 *.zip 删除所有的zip rz 上传新的zip包 6。解压 unzip 空…

ant中的table和pagination表格分页结合使用 手写分页

表格部分 <a-table:row-selection"rowSelection" :columns"columns":data-source"data"class"components-table-demo-nested"change"onChangeTable":scroll"{ x:1600 ,y:500}":pagination"pagination&qu…

poj3692

最大独立集&#xff0c;把不认识的男女看成是有矛盾的&#xff0c;要选出一些互相没有矛盾的男女。 View Code #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std;#define maxn 205bool g[maxn][max…

在项目里交叉使用Swift和OC

From: http://blog.csdn.net/huangchentao/article/details/35278663 Swift and Objective-C in the Same Project 在项目里交叉使用Swift和OC Swift与OC的兼容性使得你可以在项目里使用SwiftOC的方式编写应用程序&#xff0c;称为混合匹配(mix and match)&#xff0c;用这种…

WireShark抓包,may be caused by ip checksum offload的解决办法

From: http://blog.csdn.net/yanjiee/article/details/8051494 今天在用WireShark抓包的时候&#xff0c;发现由本机发出去的包都是黑底红字&#xff0c;点进去看了一下发现都是报“may be caused by ip checksum offload”这样一个错误。 于是在网络上搜了一下关于Checksum o…

使用Dezender对zend加密后的php文件进行解密

在开发中需要修改一些php文件&#xff0c;部分是通过zend加密的&#xff0c;记事本打开之后是这样的&#xff1a; 此时需要使用Dezender进行解密&#xff0c;下载链接如下&#xff1a; Dezender.7z 下载后解压到C盘(路径不要带有中文)&#xff0c;如解压到其他位置&#xff0c;…

vue-cli3引入第三方的js依赖包并使用其方法

注意&#xff1a;引入第三方的包有两种&#xff0c;一种是做特殊要求必须如何引用的&#xff1b;一种是没有要求的 情况1&#xff1a;js包要求了如何引入的&#xff0c;按照其文档的方式引入和使用即可 1.1直接在indes.html按照要求引入 1.2使用方法 情况2&#xff1a;没…

autoconf.mk详析

uboot的顶层Makefile中有如下的一段代码[plain] view plaincopy # # Auto-generate the autoconf.mk file (which is included by all makefiles) # # This target actually generates 2 files; autoconf.mk and autoconf.mk.dep. # the dep file is only include in this …

都是大人物,看看你认识几个。

突然找到一张老图&#xff0c;但是一直没能认识全部的人&#xff0c;下面名单是填的&#xff0c;不一定都正确。 &#xff08;想要原图留下邮件&#xff0c;我偶尔上来&#xff0c;如果看到会发给你的&#xff09; 1Bill Gates 比尔盖茨2Audrey Hepburn奥黛丽赫本3Charlie Cha…

ant中的table行列不对齐问题,以及换行,隐藏等问题

注意&#xff1a;ant中的table表格&#xff0c;列的宽度如果设置了&#xff0c;那么该列就是设置的宽度&#xff1b;那些没设置宽度的列&#xff0c;列宽&#xff08;总宽度 - 设置的列宽总和&#xff09;/ 未设置的列的个数&#xff0c;即平均宽度&#xff1b; 1.如果表格只是…

MAC OS X10.9.5下成功驱动独立显卡影驰Nvidia GeForce GTX 760大将(4GB)--非公版

我的机器是台式机(自己组装的)&#xff0c;硬件参数如下&#xff1a; 操作系统 Windows 7 旗舰版 64位 SP1 ( DirectX 11 )处理器 英特尔 Core i7-4770K 3.50GHz 四核 主板 华硕 Z87-PRO (英特尔 Haswell) 内存 8 GB ( 金士顿 DDR3 1778MHz ) 主硬…

vue-cli3项目通过vue如何引入第三方js包完成登陆功能

注意&#xff1a;本次登陆&#xff0c;前后端分离&#xff1b;前端通过引入第三方的js包&#xff0c;调用js包里的初始化方法和提交方法完成登陆以及退出&#xff1b; 流程1.引入第三方包 1.1在index.html文件下引入 流程2.完成初始化 在组件的created下完成初始化 问题2.1因…

前端vscode插件合集

工欲善其事必先利其器 安装步骤 . . . . . . . . . 1.中文包Chinese (Simplified) Language Pack for Visual Studio Code 2.自动闭合标签Auto Close Tag 3.同步修改标签Auto Rename Tag 4.高亮代码的回调&#xff0c;括号的区域范围Bracket Pair Colorizer 4.支持多中…