CentOS 6下yum 安装Samba文件服务器
安装samba
linuxidc@CentOS->~$ sudo yum install -y samba
linuxidc@CentOS->~$ sudo yum install -y samba-client
linuxidc@CentOS->~$ sudo yum install -y samba-common
linuxidc@CentOS->~$ sudo yum install -y samba-winbind
linuxidc@CentOS->~$ sudo yum install -y samba-winbind-clients
创建samba用户的方式1
[root@CentOS ~]# useradd share #创建系统用户
[root@CentOS ~]# smbpasswd -a share
New SMB password:share
Retype new SMB password:share
创建samba用户的方式2
[root@CentOS ~]# useradd samba_user1
[root@CentOS ~]# pdbedit -a samba_user1
new password:samba_user1
retype new password:samba_user1
pdbedit -L #列出所有samba用户
pdbedit -L [username] 查看samba用户
pdbedit -Lv [username] 查看samba用户详细信息
pdbedit -X username 删除一个用户
创建文件目录存放路径,修改权限
mkdir /opt/smb
chmod o+w /opt/smb/
#修改samba配置
[root@CentOS ~]# cp /etc/samba/smb.conf /etc/samba/smb.conf.install
[root@CentOS ~]# > /etc/samba/smb.conf
[root@CentOS ~]# vim /etc/samba/smb.conf
log file = /var/log/samba/log.%m
max log size = 50
security = user
smb passwd file = /etc/samba/smbpasswd
load printers = yes
cups options = raw
create mode = 0644
force create mode = 0644
directory mode = 0755
force directory mode = 0755
[MyShare]
path = /opt/smb/
valid users = share,samba_user1
writable = yes
#重启samba服务
[root@CentOS ~]# chkconfig smb on
[root@CentOS samba]# service smb restart
Shutting down SMB services: [ OK ]
Starting SMB services:
#查看samba监听状态
[root@CentOS samba]# netstat -utnlp | grep smb
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 10510/smbd
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 10510/smbd
tcp 0 0 :::139 :::* LISTEN 10510/smbd
tcp 0 0 :::445 :::* LISTEN 10510/smbd
[root@CentOS samba]#
iptables -F 关闭防火墙
#Windows登录samba服务器
创建文件,创建目录
Linux挂载samba服务器
linuxidc@CentOS->~$ sudo mount -t cifs //172.16.20.139/MyShare ~/samba/ -o username=samba_user1,password=samba_user1
linuxidc@CentOS->~$ mount | grep "172.16.20.139"
//172.16.20.139/MyShare on /home/linuxidc/samba type cifs (rw)
linuxidc@CentOS->~$ cd /home/linuxidc/samba/
linuxidc@CentOS->samba$ touch test.file
touch: 无法创建"test.file": 权限不够
用root用户可以执行挂载,root可以写入
------------------------------------分割线------------------------------------
CentOS 7.2 安装配置Samba服务器 http://www.linuxidc.com/Linux/2017-03/141390.htm
VMWare 虚拟机 Ubuntu 双网卡 访问 samba 速度 翻倍 http://www.linuxidc.com/Linux/2013-06/85445.htm
Ubuntu 15.04安装Samba服务 http://www.linuxidc.com/Linux/2016-03/129201.htm
samba安装使用图解 http://www.linuxidc.com/Linux/2017-03/141254.htm
CentOS 7.2 安装配置Samba服务器 http://www.linuxidc.com/Linux/2017-03/141390.htm
CentOS部署Samba企业文件共享服务 http://www.linuxidc.com/Linux/2016-06/132609.htm
Samba共享服务器的搭建优化 http://www.linuxidc.com/Linux/2017-03/141700.htm
CentOS 6.7下 Samba服务器的搭建与配置(share共享模式) http://www.linuxidc.com/Linux/2016-12/138220.htm
Ubuntu 16.04下Samba相关配置 http://www.linuxidc.com/Linux/2016-12/138498.htm
------------------------------------分割线------------------------------------
Samba 的详细介绍:请点这里
Samba 的下载地址:请点这里
本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-04/143046.htm
![linux](/linuxfile/logo.gif)