关闭防火墙和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‘
- 创建文件夹
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
文件传输成功
原文地址:https://blog.51cto.com/14375810/2429576
时间: 2024-11-18 19:52:17