修正 markdown 语法错误。

Signed-off-by: ithink.chan <chenyang@autoai.com>
This commit is contained in:
ithink.chan 2019-07-31 10:00:41 +08:00
parent 058d458e9a
commit d72eb07f9a
1 changed files with 96 additions and 88 deletions

View File

@ -8,12 +8,16 @@ smbd 的运行依赖于 /etc/samba/smb.conf 配置文件,这个是 smbd 的默
SELinux 开启的状态下会影响其他系统对 Samba 服务器的访问,可能造成 Windows 或 Android 系统的 Samba 客户端无法访问服务器(错误提示内容类似于没有授权之类),可以关闭 SELinux 或正确设置 SELinux。临时关闭 SELinux 的方法如下: SELinux 开启的状态下会影响其他系统对 Samba 服务器的访问,可能造成 Windows 或 Android 系统的 Samba 客户端无法访问服务器(错误提示内容类似于没有授权之类),可以关闭 SELinux 或正确设置 SELinux。临时关闭 SELinux 的方法如下:
$ setenforce 0 ```sh
setenforce 0
```
此时查看 SeLinux 状态 此时查看 SeLinux 状态
$ sestatus ```sh
Current mode: permissive sestatus
Current mode: permissive
```
永久关闭 SeLinux需要重启需要修改 /etc/selinux/config 文件: 永久关闭 SeLinux需要重启需要修改 /etc/selinux/config 文件:
@ -27,7 +31,7 @@ SELinux 开启的状态下会影响其他系统对 Samba 服务器的访问,
SELINUX=disabled SELINUX=disabled
# SELINUXTYPE= can take one of three two values: # SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected, # targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected. # minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection. # mls - Multi Level Security protection.
SELINUXTYPE=targeted SELINUXTYPE=targeted
``` ```
@ -57,14 +61,18 @@ sync always = yes
在 shell 中输入如下命令为 samba 服务分配账户和密码 在 shell 中输入如下命令为 samba 服务分配账户和密码
$ smbpasswd -a <user name> ```sh
smbpasswd -a <user name>
```
## 开启 Samba 服务 ## 开启 Samba 服务
通过 systemctl 开启 samba 服务命令如下: 通过 systemctl 开启 samba 服务命令如下:
$ systemctl enable smb.service ```sh
$ systemctl start smb.service systemctl enable smb.service
systemctl start smb.service
```
必要时需要关闭防火墙,或设置防火墙规则。 必要时需要关闭防火墙,或设置防火墙规则。
@ -156,13 +164,13 @@ sync always = yes
# hosts deny = the hosts not allowed to connect. This option can also be used on # hosts deny = the hosts not allowed to connect. This option can also be used on
# a per-share basis. # a per-share basis.
# #
workgroup = MYGROUP workgroup = MYGROUP
server string = Samba Server Version %v server string = Samba Server Version %v
; netbios name = MYSERVER ;netbios name = MYSERVER
; interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24 ;interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24
; hosts allow = 127. 192.168.12. 192.168.13. ;hosts allow = 127. 192.168.12. 192.168.13.
# --------------------------- Logging Options ----------------------------- # --------------------------- Logging Options -----------------------------
# #
@ -172,10 +180,10 @@ sync always = yes
# files are rotated when they reach the size specified with "max log size". # files are rotated when they reach the size specified with "max log size".
# #
# log files split per-machine: # log files split per-machine:
log file = /var/log/samba/log.%m log file = /var/log/samba/log.%m
# maximum size of 50KB per log file, then rotate: # maximum size of 50KB per log file, then rotate:
max log size = 50 max log size = 50
# ----------------------- Standalone Server Options ------------------------ # ----------------------- Standalone Server Options ------------------------
# #
@ -188,8 +196,8 @@ sync always = yes
# compatibility. # compatibility.
# #
security = user security = user
passdb backend = tdbsam passdb backend = tdbsam
# ----------------------- Domain Members Options ------------------------ # ----------------------- Domain Members Options ------------------------
@ -212,11 +220,11 @@ sync always = yes
# #
# Use "password server = *" to automatically locate Domain Controllers. # Use "password server = *" to automatically locate Domain Controllers.
; security = domain ;security = domain
; passdb backend = tdbsam ;passdb backend = tdbsam
; realm = MY_REALM ;realm = MY_REALM
; password server = <NT-Server-Name> ;password server = <NT-Server-Name>
# ----------------------- Domain Controller Options ------------------------ # ----------------------- Domain Controller Options ------------------------
# #
@ -240,30 +248,30 @@ sync always = yes
# logon path = specifies (with a UNC path) where user profiles are stored. # logon path = specifies (with a UNC path) where user profiles are stored.
# #
# #
; security = user ;security = user
; passdb backend = tdbsam ;passdb backend = tdbsam
; domain master = yes ;domain master = yes
; domain logons = yes ;domain logons = yes
# the following login script name is determined by the machine name # the following login script name is determined by the machine name
# (%m): # (%m):
; logon script = %m.bat ;logon script = %m.bat
# the following login script name is determined by the UNIX user used: # the following login script name is determined by the UNIX user used:
; logon script = %u.bat ;logon script = %u.bat
; logon path = \\%L\Profiles\%u ;logon path = \\%L\Profiles\%u
# use an empty path to disable profile support: # use an empty path to disable profile support:
; logon path = ;logon path =
# various scripts can be used on a domain controller or a stand-alone # various scripts can be used on a domain controller or a stand-alone
# machine to add or delete corresponding UNIX accounts: # machine to add or delete corresponding UNIX accounts:
; add user script = /usr/sbin/useradd "%u" -n -g users ;add user script = /usr/sbin/useradd "%u" -n -g users
; add group script = /usr/sbin/groupadd "%g" ;add group script = /usr/sbin/groupadd "%g"
; add machine script = /usr/sbin/useradd -n -c "Workstation (%u)" -M -d /nohome -s /bin/false "%u" ;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 script = /usr/sbin/userdel "%u"
; delete user from group script = /usr/sbin/userdel "%u" "%g" ;delete user from group script = /usr/sbin/userdel "%u" "%g"
; delete group script = /usr/sbin/groupdel "%g" ;delete group script = /usr/sbin/groupdel "%g"
# ----------------------- Browser Control Options ---------------------------- # ----------------------- Browser Control Options ----------------------------
@ -277,9 +285,9 @@ sync always = yes
# preferred master = when set to yes, Samba forces a local browser election at # 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). # start up (and gives itself a slightly higher chance of winning the election).
# #
; local master = no ;local master = no
; os level = 33 ;os level = 33
; preferred master = yes ;preferred master = yes
#----------------------------- Name Resolution ------------------------------- #----------------------------- Name Resolution -------------------------------
# #
@ -299,11 +307,11 @@ sync always = yes
# dns proxy = when set to yes, Samba attempts to resolve NetBIOS names via DNS # dns proxy = when set to yes, Samba attempts to resolve NetBIOS names via DNS
# nslookups. # nslookups.
; wins support = yes ;wins support = yes
; wins server = w.x.y.z ;wins server = w.x.y.z
; wins proxy = yes ;wins proxy = yes
; dns proxy = yes ;dns proxy = yes
# --------------------------- Printing Options ----------------------------- # --------------------------- Printing Options -----------------------------
# #
@ -319,13 +327,13 @@ sync always = yes
# printcap name = used to specify an alternative printcap file. # printcap name = used to specify an alternative printcap file.
# #
load printers = yes load printers = yes
cups options = raw cups options = raw
; printcap name = /etc/printcap ;printcap name = /etc/printcap
# obtain a list of printers automatically on UNIX System V systems: # obtain a list of printers automatically on UNIX System V systems:
; printcap name = lpstat ;printcap name = lpstat
; printing = cups ;printing = cups
# --------------------------- File System Options --------------------------- # --------------------------- File System Options ---------------------------
# #
@ -338,53 +346,53 @@ sync always = yes
# Note: These options can be used on a per-share basis. Setting them globally # 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. # (in the [global] section) makes them the default for all shares.
; map archive = no ;map archive = no
; map hidden = no ;map hidden = no
; map read only = no ;map read only = no
; map system = no ;map system = no
; store dos attributes = yes ;store dos attributes = yes
#============================ Share Definitions ============================== #============================ Share Definitions ==============================
[homes] [homes]
comment = Home Directories comment = Home Directories
browseable = no browseable = no
writable = yes writable = yes
; valid users = %S ;valid users = %S
; valid users = MYDOMAIN\%S ;valid users = MYDOMAIN\%S
[printers] [printers]
comment = All Printers comment = All Printers
path = /var/spool/samba path = /var/spool/samba
browseable = no browseable = no
guest ok = no guest ok = no
writable = no writable = no
printable = yes printable = yes
# Un-comment the following and create the netlogon directory for Domain Logons: # Un-comment the following and create the netlogon directory for Domain Logons:
; [netlogon] ;[netlogon]
; comment = Network Logon Service ;comment = Network Logon Service
; path = /var/lib/samba/netlogon ;path = /var/lib/samba/netlogon
; guest ok = yes ;guest ok = yes
; writable = no ;writable = no
; share modes = no ;share modes = no
# Un-comment the following to provide a specific roaming profile share. # Un-comment the following to provide a specific roaming profile share.
# The default is to use the user's home directory: # The default is to use the user's home directory:
; [Profiles] ;[Profiles]
; path = /var/lib/samba/profiles ;path = /var/lib/samba/profiles
; browseable = no ;browseable = no
; guest ok = yes ;guest ok = yes
# A publicly accessible directory that is read only, except for users in the # A publicly accessible directory that is read only, except for users in the
# "staff" group (which have write permissions): # "staff" group (which have write permissions):
; [public] ;[public]
; comment = Public Stuff ;comment = Public Stuff
; path = /home/samba ;path = /home/samba
; public = yes ;public = yes
; writable = no ;writable = no
; printable = no ;printable = no
; write list = +staff ;write list = +staff
``` ```