mysql安装samba_centos 安装samba

本文档详细介绍了在CentOS系统上安装Samba的过程,包括关闭SELinux,安装samba及其依赖,配置Samba共享目录,设置开机启动,创建用户,以及客户端如何映射Samba共享。通过这些步骤,可以实现CentOS服务器上的文件共享功能。
摘要由CSDN通过智能技术生成

关闭SELinux

# 临时关闭

setenforce 0

# 修改配置文件

vim /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing - SELinux security policy is enforced.

# permissive - SELinux prints warnings instead of enforcing.

# disabled - No SELinux policy is loaded.

SELINUX=enforcing

# SELINUXTYPE= can take one of three two values:

# targeted - Targeted processes are protected,

# minimum - Modification of targeted policy. Only selected processes are protected.

# mls - Multi Level Security protection.

SELINUXTYPE=targeted

安装samba

yum install samba samba-client samba-swat

安装成功之后查看服务状态

service smb status

# 以下是状态 未启动 证明安装成功

smb.service - Samba SMB Daemon

Loaded: loaded (/usr/lib/systemd/system/smb.service; disabled; vendor preset: disabled)

Active: inactive (dead)

添加开机启动

chkconfig --level 35 smb on

取消开机启动

chkconfig --level 35 smb off

配置

添加 share 并指定目录 /home/share

vim /etc/samba/smb.conf

# 修改为如下内容

# See smb.conf.example for a more detailed config file or

# read the smb.conf manpage.

# Run 'testparm' to verify the config is correct after

# you modified it.

[global]

workgroup = SAMBA

security = user

passdb backend = tdbsam

# map to guest = Bad Password

#guest account = guest

[share]

comment = share folder

path = /home/share

create mask = 0664

directory mask = 0775

browseable = yes

writable = yes

public = yes

运行 testparm 检查配置是否正确

testparm

添加用户

运行下面命令 添加root用户并设置密码

smbpasswd -a root

启动并查看状态

service smb start

service smb status

客户端安装并映射

1. 安装映射工具

yum install cifs-utils

2. mount映射

mount -t cifs //serviceip//share /home/share -o username=root,password=123123

3. 取消映射

umount /home/share

4. 添加开机自动映射

vim /etc/fstab

#追加

//serviceip/share /home/share cifs defaults,auto,username=root,password=123123 0 0

文章来源于互联网,如有雷同请联系站长删除:centos 安装samba

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值