linux 安装samba并且无需账户登录访问

摘要

1、linux下安装samba服务
2、配置samba服务

一、 安装环境

1、 Centos

yum install samba

2、 Ubuntu

apt install samba
apt update

二、编辑配置文件

vi /etc/samba/smb.conf
[global]
    	workgroup = SAMBA
		security = user
		map to guest = Bad User

		passdb backend = tdbsam

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

#[homes]
#        comment = Home Directories
#        browseable = no
#        writable = yes
#        valid users = %S

#[printers]
#        comment = All Printers
#        path = /var/spool/samba
#        browseable = no
#        guest ok = no
#        writable = no
#        printable = yes

#[prints$]
#        comment = Printer Drivers
#        path = /var/lib/samba/drivers
#        write list = @printadmin root
#        force group = @printadmin
#        create mask = 0664
#        directory mask = 0775

[home]
    	comment = home
    	path = /home
    	public = yes
    	writable = yes
    	browseable = yes
    	guest ok = yes

配置说明:

旧版本

#security = user    // 注释掉原来的user
security = share  	// 变成共享的

新版本

security = user
map to guest = Bad User  	//加上这行

新版本用方式1会启动失败。

三、启动服务

systemctl restart smb

四、其他问题

1、如果出现资源管理器无法打开samba地址
关闭防火墙或开启防火墙端口白名单

systemctl stop firewalld
systemctl diabled firewalld

2、如果出现资源管理器无法写入
暂时关闭selinux

setenforce 0

永久关闭selinux(重启生效)

vi /etc/selinux/config
#SELINUX=enforcing		// 注释该行
SELINUX=disable			//加入这行

3、无论怎么修改都需要输入验证

sudo smbpasswd -a root

添加root(随意使用已有的用户名),再填入密码,使用该用户登录

五、使用

在资源管理器打开 \\192.168.*.*\ 就能打开已开启的samba服务

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值