0%

centos7 smb 用户登录访问

关闭防火墙

1
systemctl stop firewalld

关闭Selinux

1
setenforce 0

安装smb

1
yum install -y samba

创建用户

1
2
3
4
5
6
7
8
9
10
11
[root@localhost ~]# useradd centos
[root@localhost ~]# smbpasswd -a centos
New SMB password:
Retype new SMB password:
Added user centos.
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# smbpasswd -e centos
Enabled user centos.
[root@localhost ~]#

创建共享目录并更改权限

1
2
3
[root@localhost /]#cd /
[root@localhost /]# mkdir /share
[root@localhost /]# chown centos /share

修改smb配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.

[global]
workgroup = SAMBA
security = user

passdb backend = tdbsam

printing = cups
printcap name = cups
load printers = yes
cups options = raw

#[homes]
; comment = Home Directories
; valid users = %S, %D%w%S
; browseable = No
; read only = No
; inherit acls = Yes

;[printers]
; comment = All Printers
; path = /var/tmp
; printable = Yes
; create mask = 0600
; browseable = No

;[print$]
; comment = Printer Drivers
; path = /var/lib/samba/drivers
; write list = @printadmin root
; force group = @printadmin
; create mask = 0664
; directory mask = 0775
[share]
comment = sbm
path = /share
writable = yes
guest ok = no
valid users = @centos

启动smb

1
systemctl start smb nmb