码迷,mamicode.com
首页 > 系统相关 > 详细

linux Samba搭建

时间:2019-08-14 23:43:10      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:grep -E   防火   路径   stat   cat   systemctl   enforce   str   serve   

关闭防火墙和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(输入用户与密码)
技术图片
进入shared文件中创建一个文档,feng

cd /storage/shared 
vim feng
ls

最后打开shared就会出现创建的feng
技术图片

文件传输成功

linux Samba搭建

标签:grep -E   防火   路径   stat   cat   systemctl   enforce   str   serve   

原文地址:https://blog.51cto.com/14375810/2429577

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!