【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,一经查实,立即删除!

相关文章

64位ubuntu安装交叉编译器出现的问题。nuc972工程中的问题

现象 &#xff1a;arm-linux-gcc-v 出现no such file or dir. 解决办法&#xff1a;apt-get install lsb-core 现象&#xff1a;gcc: error while loading shared libraries: libstdc.so.6: cannot open shared object file: No such file or directory 解决办法&#xff1a;ap…

Linux PCI网卡驱动分析

http://www.uplinux.com/shizi/wenxian/4429.html Linux网卡驱动分析 学习应该是一个先把问题简单化&#xff0c;在把问题复杂化的过程。一开始就着手处理复杂的问题&#xff0c;难免让人有心惊胆颤&#xff0c;捉襟见肘的感觉。读Linux网卡驱动也是一样。那长长的源码夹杂着那…

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

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

Ubuntu 12.04 LTS安装VMware Tools:无法找到kernel header path的问题

From: http://www.cnblogs.com/lifegoesonitself/p/3357375.html Ubuntu 12.04 安装 VMware Tools&#xff0c;运行vmware-config-tools.pl 时&#xff0c;总是提示The path "" is not valid.What is the location of the directory of C header files that match y…

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…

串口VMIN VTIME 详解

以前跟着做过VxWorks的开发&#xff0c;主要通信方式是串口&#xff0c;因为底层BSP包已经做好了&#xff0c;串口通信非常简单。后来接触Linux&#xff0c;在一块OK6410上跑Linux串口通信&#xff0c;才发现原来天真的以为甚是简单的串口变得如此的不简单。#include <termi…

cocos2dx 3.0 windows平台 中文乱码解决

From: http://www.cnblogs.com/yujiaao/p/3691938.html 因为linux下cocostudio wine安装不上 而且又要开发windows程序 果断舍弃了ubuntu而实用vs2013 去玩cocos2dx3.0 花了一天的时间才解决中文乱码 泪奔ing 分享记录下 下面是我尝试的的过程&#xff1a; 1相关设置 右键项…

liux 常用操作命令

tail -f /home/jyapp/apache-tomcat-7.0.59/logs/catalina.out //查看实施日志 //删除临时目录并且启动服务器 rm -rf /home/jyapp/apache-tomcat-7.0.59/work/* & rm -rf /home/jyapp/apache-tomcat-7.0.59/temp/* &/home/jyapp/apache-tomcat-7.0.59/bin/startup.sh…

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…

NFS调试linux内核启动卡死在DHCP和RARP上

手头有两块板子。第一块有两个网卡phy&#xff0c;第二块一个网卡phy。为了驱动的统一使用&#xff0c;在内核中都配置如下 Device Drivers ---> [*] Network device support ---><*>Dummy net driver support <*> Nuvoton NUC970 Ethernet MAC 0 <*>…

在项目里交叉使用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;用这种…

IE请求json数据时出现下载文件的现象。

当使用IE浏览器请求服务器时&#xff0c;会出现下载json文件的现象&#xff0c;就需要在spring-MVC.xml文件里配置&#xff1a; <bean class"org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" id"mappingJacksonHttpMessageCon…

Linux下查看TOMCAT控制台

Linux下查看TOMCAT控制台 $ ./catalina.sh run 就可以了。 debug模式&#xff1a; $ ./catalina.sh debug ...... help (查看帮助) exit&#xff08;退出、终止tomcat&#xff09; catalina.sh [para] para: debug start Catalina in a d…

Nandflash希尔特编程器烧录带来的一些点知识信息

1&#xff0e;NAND FLASH的特殊性 1)存在坏块。NAND FLASH由于其生产工艺的原因&#xff0c;出厂芯片中会随机包含坏块。坏块在出厂时已经被初始化&#xff0c;并在特定区域中存在标记&#xff0c;如果在使用过程中出现坏块&#xff0c;也需要进行标记。2)易出现位反转。NAND F…