Ubuntu12中samba环境搭建与使用

这里简单地整理了下(最好以root身份来执行以下命令):

# ready: update source
apt-get update

# install samba software
apt-get install samba
apt-get install smbfs

# create samba shared folder
mkdir /home/zcm/work

# config samba: vi /etc/samba/smb.conf
security = user
username map = /etc/samba/smbusers

[global]
	workgroup = WORKGROUP
	display charset = UTF-8
	unix charset = UTF-8
	dos charset = cp936

# share folder by samba
[share]
	comment = global sharing folder
	read only = no
	locking = no
	path = /share
	guest ok = yes

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


# set password for samba user
	smbpasswd -a zcm

# restart samba service
	/etc/init.d/smbd restart

# delete samba user
	smbpasswd -x zcm

完整的/etc/samba/smb.conf配置文件内容为:

[root@samba #44]#cat smb.conf
#
# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# 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 most of which 
# are not shown in this example
#
# Some options that are often worth tuning have been included as
# commented-out examples in this file.
#  - When such options are commented with ";", the proposed setting
#    differs from the default Samba behaviour
#  - When commented with "#", the proposed setting is the default
#    behaviour of Samba but the option is considered important
#    enough to be mentioned here
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not made any basic syntactic 
# errors. 
# A well-established practice is to name the original file
# "smb.conf.master" and create the "real" config file with
# testparm -s smb.conf.master >smb.conf
# This minimizes the size of the really used smb.conf file
# which, according to the Samba Team, impacts performance
# However, use this with caution if your smb.conf file contains nested
# "include" statements. See Debian bug #483187 for a case
# where using a master file is not a good idea.
#

#======================= Global Settings =======================

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
    workgroup = WORKGROUP
        display charset = UTF-8
        unix charset = UTF-8
        dos charset = cp936

# server string is the equivalent of the NT Description field
   server string = %h server (Samba, 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Ubuntu 18.04 上搭建 Samba 服务器可以通过以下步骤完成: 1. 首先,确保你的系统是最新的,可以运行以下命令进行系统更新: ``` sudo apt update sudo apt upgrade ``` 2. 安装 Samba 服务器软件包,可以运行以下命令进行安装: ``` sudo apt install samba ``` 3. 在安装完成后,编辑 Samba 的主配置文件 `/etc/samba/smb.conf`,可以使用以下命令进行编辑: ``` sudo nano /etc/samba/smb.conf ``` 4. 在配置文件,你可以定义共享的文件夹和访问权限。在文件的末尾,你可以添加以下示例配置来创建一个共享名为 "share" 的文件夹: ``` [share] comment = Shared Folder path = /path/to/shared/folder browsable = yes guest ok = yes read only = no create mask = 0777 directory mask = 0777 ``` 请确保将 `/path/to/shared/folder` 替换为你实际要共享的文件夹路径。 5. 保存并关闭文件。然后,重新启动 Samba 服务以使更改生效: ``` sudo service smbd restart ``` 6. 默认情况下,Samba 使用的是系统用户认证。你可以使用以下命令为 Samba 创建一个用户,并为该用户设置密码: ``` sudo smbpasswd -a username ``` 将 "username" 替换为你要创建的用户名。 7. 最后,你可以通过其他计算机上的文件管理器或命令行窗口访问 Samba 共享。输入以下地址进行访问: ``` smb://<ip-address>/share ``` 将 "<ip-address>" 替换为运行 SambaUbuntu 18.04 的 IP 地址。 这样,你就可以在 Ubuntu 18.04 上成功搭建一个 Samba 服务器,并共享文件夹。希望对你有所帮助!如有其他问题,请随时提问。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值