1、检查系统是否已经安装samba
rpm -qa samba
2、如有安装请卸载,否则直接看第3步
rpm -e xxxx -f --nodeps
3、安装samba,相关依赖会自动安装,注意按“y”确认
yum install samba
4、检查安装完成(我这边安装的版本是3.xx,4.xx版本区别较大)
5、 service iptalbes status 检查防火墙状态,并进行关闭
6、关闭selinux
vim /etc/selinux/config #永久关闭selinux
set SELINUX=disabled #SELINUX=enforcing改为SELINUX=disabled
7、修改/etc/samba/smb.conf配置
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
# logs split per machine
log file = /var/log/samba/log.%m
# max 50KB per log file, then rotate
max log size = 50
security = share
passdb backend = tdbsam
load printers = no
cups options = raw
[homes]
comment = Home Directories
browseable = no
writable = yes
; valid users = %S
; valid users = MYDOMAIN\%S
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes
[usershare]
comment = Home Directories
path = /home/shareuser
browseable = yes
writable = yes
guest ok = yes
8、启动samba
/etc/init.d/smb restart
/etc/init.d/nmb restart
9、windows访问 (免密)
\\192.168.65.68
10、使用jcifs.jar 操作samba上的文件
依赖
<dependency>
<groupId>jcifs</groupId>
<artifactId>jcifs</artifactId>
<version>1.3.17</version>
</dependency>
本文详细介绍了如何在Linux系统上部署Samba服务,包括检查与安装Samba软件包、配置防火墙与SELinux、编辑smb.conf配置文件、启动服务及通过Windows客户端访问等步骤。
服务器&spm=1001.2101.3001.5002&articleId=81325267&d=1&t=3&u=f68b07defc4a478188ca59e0f79a6b7b)
858

被折叠的 条评论
为什么被折叠?



