linux Samba搭建

限于喜欢 提交于 2020-03-25 06:16:06

关闭防火墙和SElinux

systemctl stop firewalld
setenforce 0

1.安装samba应用

systemctl start smb nmb

2.启动Samba应用

systemctl start smb nmb

3.查看Samba服务进程

ps -ef | grep -E 'smb | nmb'

4.查看Samba应用服务端口

netstat -tunlp | grep -E 'smbd|nmbd'
  1. 创建文件夹
    cd /
    mkdir storage
    mkdir logger shared
    ls

创建用户

useradd -s /sbin/nologin logadmin
useradd -s /sbin/nologin admin
useradd -g admin -s /sbin/nologin shared
cat /etc/passwd

6建立Samba用户

smbpasswd -a logadmin
smbpasswd -a admin
smbpasswd -a shared

7.更改目录属性

chown logadmin.logadmin logger
chown admin.admin shared
chmod -R 777 logger
chmod -R 777 shared

8.配置Samba服务

vim /etc/samba/smb.conf
[global]
workgroup = SC.LOCAL
server string = Samba Server Version %v
netbios name = Linuxidc-Server
log file = /var/log/samba/%m.log
max log size = 10240
security = user
passdb backend = tdbsam
[logger]
comment = Logs Directories
path = /storage/logger/
public = no
admin users = logadmin
valid users = @logadmin
browseable = yes
writable = yes
create mask = 0777
directory mask = 0777
force directory mode = 0777
force create mode = 0777
[shared]
comment = Shared Directories
path = /storage/shared/
public = no
admin users = admin
valid users = @admin
browseable = yes
writable = yes
create mask = 0777
directory mask = 0777
force directory mode = 0777
force create mode = 0777

重启

/sbin/service smb start

9.访问Samba服务
使用Windows客户机通过UNC路径访问Samba服务 \192.168.253.129(输入用户与密码)
linux Samba搭建
进入shared文件中创建一个文档,feng

cd /storage/shared 
vim feng
ls

最后打开shared就会出现创建的feng
linux Samba搭建

文件传输成功

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!