windows访问samba共享文件夹配置说明

网上有很多关于此问题的说明,但五花八门,很多人都没配置成功,我试了几个也不成功,研究了下重新整理了个亲测可使用的配置说明
技术交流QQ群242722019


1、关闭防火墙iptables和SELinux
2、安装samba服务yum -y install samba
3、useradd smb //首先创建一个测试账号用于登录samba验证用户
4、chown -R smb:smb chatroom/  //这里举例我要把chatroom文件夹作为共享文件夹,更改当前文件夹及里面文件的所属组为smb所有
5、开始进行smb.conf配置文件的设置
6、smbpasswd smb //为smb账号设置独立的smbpasswd
7、启动 service smb start


附上
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 -------------------------
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Samba是一个开源软件,它允许LinuxWindows操作系统之间共享文件和打印机。Samba服务器可以轻松地配置共享文件夹,从而使多个计算机上的用户可以访问该文件夹。下面是一些配置Samba共享文件夹的基本步骤: 1. 安装Samba软件包:在Linux操作系统上,您需要首先安装Samba软件包。在Ubuntu上,您可以使用以下命令进行安装:sudo apt-get install samba。 2. 配置共享文件夹:要配置共享文件夹,请打开Samba配置文件(/etc/samba/smb.conf)并添加以下内容: ``` [share] comment = Shared Folder path = /path/to/folder read only = no browsable = yes ``` 其中,[share]是共享文件夹的名称,“comment”是对共享文件夹的描述,“path”是要共享的文件夹路径,“read only”表示只读权限,“browsable”表示该文件夹是否可浏览。 3. 创建Samba用户:在Samba中,每个用户都需要有一个对应的用户名和密码。您可以使用以下命令创建一个新用户并将其添加到Samba用户列表中:sudo smbpasswd -a username。 4. 重启Samba服务:在修改了Samba配置文件后,需要重新启动Samba服务以使更改生效。在Ubuntu上,您可以使用以下命令重启Samba服务:sudo service smbd restart。 至此,您已经成功地配置了一个Samba共享文件夹。如果您想从Windows计算机上访问该文件夹,请打开“计算机”并输入Linux计算机的IP地址,然后输入您在第三步中创建的用户名和密码即可访问共享文件夹

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值