samba应用常见问题 和 修改后的smb.conf文件

 一.samba的安装:

sudo apt-get insall samba

sudo apt-get install smbfs

二. 创建共享目录:

mkdir /home/phinecos/share

sodu chmod 777 /home/phinecos/share

三. 创建Samba配置文件:

1. 保存现有的配置文件

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

2. 修改现配置文件

sudo gedit /etc/samba/smb.conf

在smb.conf最后添加

[share]

path = /home/phinecos/share

available = yes

browsealbe = yes

public = yes

writable = yes

四. 创建samba帐户

sudo touch /etc/samba/smbpasswd

sudo smbpasswd -a phinecos

然后会要求你输入samba帐户的密码

[如果没有第四步,当你登录时会提示 session setup failed: NT_STATUS_LOGON_FAILURE]

 五. 重启samba服务器

sudo /etc/init.d/samba restart

六. 测试

smbclient -L //localhost/share

七,使用

可以到windows下输入ip使用了,在文件夹处输入 "\\" + "Ubuntu机器的ip或主机名" + "\\" + "share"

问题1:

在CENTOS上配了个SAMBA与WINDOW共享文件。

一访问共享目录就”NT_STATUS_ACCESS_DENIED listing \*“ ,找了好久,发现是SELINUX阻挡了。

解决方法:彻底关闭SELIUNX


问题2:

局域网内的共享文件能访问,但是samba服务器上的共享文件不能访问。

解决方法:

1、把samba服务器(linux)上的共享文件夹的属性改为777,命令为:chmode 777 samba_share_floder

2、关闭SELIUNX

[[email protected] /]# getenforce ;查看当前状态

Enforcing 
[[email protected] /]# setenforce 0 ;关闭


======================以下是修改后的smb.conf文件:=========================

# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options (perhaps too
# many!) most of which are not shown in this example
#
# For a step to step guide on installing, configuring and using samba, 
# read the Samba-HOWTO-Collection. This may be obtained from:
#  http://www.samba.org/samba/docs/Samba-HOWTO-Collection.pdf
#
# Many working examples of smb.conf files can be found in the 
# Samba-Guide which is generated daily and can be downloaded from: 
#  http://www.samba.org/samba/docs/Samba-Guide.pdf
#
# Any line which starts with a ; (semi-colon) or a # (hash) 
# is a comment and is ignored. In this example we will use a #
# for commentry and a ; for parts of the config file that you
# may wish to enable
#
# NOTE: Whenever you modify this file you should run the command "testparm"
# to check that you have not made any basic syntactic errors. 
#
#---------------
# SELINUX NOTES:
#
# If you want to use the useradd/groupadd family of binaries please run:
# setsebool -P samba_domain_controller on
#
# If you want to share home directories via samba please run:
# setsebool -P samba_enable_home_dirs on
#
# If you create a new directory you want to share you should mark it as
# "samba_share_t" so that selinux will let you write into it.
# Make sure not to do that on system directories as they may already have
# been marked with othe SELinux labels.
#
# Use ls -ldZ /path to see which context a directory has
#
# Set labels only on directories you created!
# To set a label use the following: chcon -t samba_share_t /path
#
# If you need to share a system created directory you can use one of the
# following (read-only/read-write):
# setsebool -P samba_export_all_ro on
# or
# setsebool -P samba_export_all_rw on
#
# If you want to run scripts (preexec/root prexec/print command/...) please
# put them into the /var/lib/samba/scripts directory so that smbd will be
# allowed to run them.
# Make sure you COPY them and not MOVE them so that the right SELinux context
# is applied, to check all is ok use restorecon -R -v /var/lib/samba/scripts
#
#--------------
#
#======================= Global Settings =====================================

[global]

# ----------------------- Network Related Options -------------------------
#
# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
#
# server string is the equivalent of the NT Description field
#
# netbios name can be used to specify a server name not tied to the hostname
#
# Interfaces lets you configure Samba to use multiple interfaces
# If you have multiple network interfaces then you can list the ones
# you want to listen on (never omit localhost)
#
# Hosts Allow/Hosts Deny lets you restrict who can connect, and you can
# specifiy it as a per share option as well
#
;	workgroup = MYGROUP
	workgroup = Workgroup
	server string = Samba_Server_information:Samba Server Version %v

;	netbios name = MYSERVER
	netbios name = mysamba

;	interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24 
;	hosts allow = 127. 192.168.12. 192.168.13.

# --------------------------- Logging Options -----------------------------
#
# Log File let you specify where to put logs and how to split them up.
#
# Max Log Size let you specify the max size log files should reach

	# logs split per machine
	log file = /var/log/samba/log.%m
	# max 50KB per log file, then rotate
	max log size = 50

# ----------------------- Standalone Server Options ------------------------
#
# Scurity can be set to user, share(deprecated) or server(deprecated)
#
# Backend to store user information in. New installations should 
# use either tdbsam or ldapsam. smbpasswd is available for backwards 
# compatibility. tdbsam requires no further configuration.

;	security = user
	security = share
	passdb backend = tdbsam

# ----------------------- Domain Members Options ------------------------
#
# Security must be set to domain or ads
#
# Use the realm option only with security = ads
# Specifies the Active Directory realm the host is part of
#
# Backend to store user information in. New installations should 
# use either tdbsam or ldapsam. smbpasswd is available for backwards 
# compatibility. tdbsam requires no further configuration.
#
# Use password server option only with security = server or if you can‘t
# use the DNS to locate Domain Controllers
# The argument list may include:
#   password server = My_PDC_Name [My_BDC_Name] [My_Next_BDC_Name]
# or to auto-locate the domain controller/s
#   password server = *

;	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
#
# Backend to store user information in. New installations should 
# use either tdbsam or ldapsam. smbpasswd is available for backwards 
# compatibility. tdbsam requires no further configuration.
#
# Domain Master specifies Samba to be the Domain Master Browser. This
# allows Samba to collate browse lists between subnets. Don‘t use this
# if you already have a Windows NT domain controller doing this job
#
# Domain Logons let Samba be a domain logon server for Windows workstations. 
#
# Logon Scrpit let yuou specify a script to be run at login time on the client
# You need to provide it in a share called NETLOGON
#
# Logon Path let you specify where user profiles are stored (UNC path)
#
# Various scripts can be used on a domain controller or stand-alone
# machine to add or delete corresponding unix accounts
#
;	security = user
;	passdb backend = tdbsam

;	domain master = yes 
;	domain logons = yes

	# the login script name depends on the machine name
;	logon script = %m.bat
	# the login script name depends on the unix user used
;	logon script = %u.bat
;	logon path = \\%L\Profiles\%u
	# disables profiles support by specifing an empty path
;	logon path =          

;	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 ----------------------------
#
# set local master to no if you don‘t want Samba to become a master
# browser on your network. Otherwise the normal election rules apply
#
# OS Level determines the precedence of this server in master browser
# elections. The default value should be reasonable
#
# Preferred Master causes Samba to force a local browser election on startup
# and gives it a slightly higher chance of winning the election
;	local master = no
;	os level = 33
;	preferred master = yes

#----------------------------- Name Resolution -------------------------------
# Windows Internet Name Serving Support Section:
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
#
# - WINS Support: Tells the NMBD component of Samba to enable it‘s WINS Server
#
# - WINS Server: Tells the NMBD components of Samba to be a WINS Client
#
# - WINS Proxy: Tells Samba to answer 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 - tells Samba whether or not to try to resolve NetBIOS names
# via DNS nslookups.

;	wins support = yes
;	wins server = w.x.y.z
;	wins proxy = yes

;	dns proxy = yes

# --------------------------- Printing Options -----------------------------
#
# Load Printers let you load automatically the list of printers rather
# than setting them up individually
#
# Cups Options let you pass the cups libs custom options, setting it to raw
# for example will let you use drivers on your Windows clients
#
# Printcap Name let you specify an alternative printcap file
#
# You can choose a non default printing system using the Printing option

	load printers = yes
	cups options = raw

;	printcap name = /etc/printcap
	#obtain list of printers automatically on SystemV
;	printcap name = lpstat
;	printing = cups

# --------------------------- Filesystem Options ---------------------------
#
# The following options can be uncommented if the filesystem supports
# Extended Attributes and they are enabled (usually by the mount option
# user_xattr). Thess options will let the admin store the DOS attributes
# in an EA and make samba not mess with the permission bits.
#
# Note: these options can also be set just per share, setting them in global
# 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 = no
	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, but read only, except for people in
# the "staff" group
;	[public]
;	comment = Public Stuff
;	path = /home/samba
;	public = yes
;	writable = yes
;	printable = no
;	write list = +staff
[samba_share]
	comment = samba server myshare space
	path=/samba_share
	browseable =yes
	writable = yes
	guest ok = yes
	public = yes

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-09-29 10:05:02

samba应用常见问题 和 修改后的smb.conf文件的相关文章

resolv.conf文件重启后失效的解决办法

问题描述:我使用yum安装软件时,提示找不到域名,应该就是DNS设置的问题,在/etc/resolv.conf中添加nameserver 8.8.8.8这一行,再次使用yum时,能正常安装软件了,但是重启服务器后,resolv.conf文件就失效了,并且变成原来的样子. 解决办法:找到网卡的配置文件,在配置文件中加入DNS1=8.8.8.8,重启网络服务,即可.我这里用的是redhat6.5版本,使用的是第一块网卡,网卡配置文件的路径是/etc/sysconfig/network-scripts

【QQ登录】回调地址常见问题及修改方法

百度一次 http://wiki.open.qq.com/wiki/[QQ登录]回调地址常见问题及修改方法 百度一下 http://wiki.connect.qq.com/回调地址常见问题及修改方法教程 http://jingyan.baidu.com/article/b87fe19e93539052183568f5.html 教程 http://www.chinaz.com/web/2015/1023/461390.shtml[QQ登录]回调地址常见问题及修改方法1. 什么是回调地址域名? 用

samba服务器配置文件smb.conf详解

配置文件详解    Samba配置文件非常简介明了,所有的设置都在/etc/samba/smb.conf配置文件中进行,通过对该配置文件的修改我们可以将Samba配置为一台匿名文件服务器.基于账户的文件服务器或打印服务器,默认Samba会开启本地帐号家目录共享与打印机共享,配置文件中以#或;符号开头的行为注释行,配置文件分为若干段,除了global(全局配置段)之外的其余所有段用来描述共享资源,全局段中的配置代表全局有效,是全局的默认设置.但如果全局配置段中的设置项与共享段中的设置项有冲突,则共

Linux系统(Ubuntu/Debian/RedHat/CentOS)超级简单的samba配置文件smb.conf

1.超简单的smb.conf 该配置文件对Ubuntu和CentOS都好用. #============== Global Settings ============== [global] ## Browsing/Identification ### workgroup = mshome server string = samba security = share wins support = no guest account = wslu #============== Share Defin

Linux Samba服务主配文件smb.conf中文详解【转】

转自:https://blog.csdn.net/maotianwang/article/details/52524732 从网上找到描述比较详细的smb.conf中文解释: 服务名:smb 配置目录:/etc/sabma/ 主配置文件:/etc/sabma/smb.conf #============================== Global Settings ============================= [global] samba服务器的全局设置,对整个服务器有效.

解决Ext4.2.3中propertyGrid修改后点击排序报错

Ext4.2.3中PropertyGrid修改后点击排序报错,具体错误信息如下: 一开始还怀疑是自己哪里配置错了,各种尝试结果还是一样.查遍百度和谷歌,无果,只有一篇帖子说是4.2.4修正了.还是自己动手吧,自己动手丰衣足食. 点开报错地方(如下图所示),原来是me.field.column没有定义. 然后继续找,找啊找啊找到Ext.grid.property.Grid的getCellEditor方法.此方法有参数column,可在方法体内,column就没有被用到过,于是就感觉问题出在这里.

SQLSERVER中返回修改后的数据

在公司看到同事写了个SQL2005的新特性的文章,觉得很实用,在这里和大家分享下. 这种技术主要是用到了inserted和deleted虚拟表,这两张表相信大家都很熟悉.以前我们主要是在触发器中使用. 我们先来复习下这两个表: Inserted和Deleted这两个表是逻辑表,并且这两个表是由系统管理的,存储在内存中,不是存储在数据库中,因此,不允许用户直接对其修改.这两个表的结构与被该触发器作用的表在相同的表结构.这两个表是动态驻留在内存中的,当触发器工作完成,它们也被删除. 接下来,看看我们

5.26在网上看到的方法,实现图形缩放、对齐、图形修改后进行dirty check。(未实验过)

目标:1. 使用ZoomManager来执行图形的缩放2. 对图形进行对齐(Alignment)操作3. 图形修改后进行dirty check(提示保存文档) 图形缩放:提供缩放能力的方法就是设置根图形的RootEditPart为ScalableRootEditPart.一般在Editor的configureGraphicalViewer()方法中设置RootEditPart.ScalableRootEditPart提供了一个ZoomManager类用来管理图形的缩放操作.通过该ZoomMana

/profile文件修改后立即生效

修改profile etc/profile文件是只读的,直接用vi或gedit打开修改后是无法保存的.要修改profile,需要取得root权限,(使用gedit编辑) $sudo gedit /etc/profile 或者 $sudo -s $gedit /etc/profile 这样打开profile文件,修改后就可以保存了. /profile文件修改后立即生效 方法1: 让/etc/profile文件修改后立即生效 ,可以使用如下命令: # .  /etc/profile 注意: . 和