CentOS 6下yum 安装Samba文件服务器
CentOS 6下yum 安装Samba文件服务器
安装samba
[email protected]>~$ sudo yum install -y samba
[email protected]>~$ sudo yum install -y samba-client
[email protected]>~$ sudo yum install -y samba-common
[email protected]>~$ sudo yum install -y samba-winbind
[email protected]>~$ sudo yum install -y samba-winbind-clients
创建samba用户的方式1
[[email protected] ~]# useradd share #创建系统用户
[[email protected] ~]# smbpasswd -a share
New SMB password:share
Retype new SMB password:share
创建samba用户的方式2
[[email protected] ~]# useradd samba_user1
[[email protected] ~]# 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配置
[[email protected] ~]# cp /etc/samba/smb.conf /etc/samba/smb.conf.install
[[email protected] ~]# > /etc/samba/smb.conf
[[email protected] ~]# 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服务
[[email protected] ~]# chkconfig smb on
[[email protected] samba]# service smb restart
Shutting down SMB services: [ OK ]
Starting SMB services:
#查看samba监听状态
[[email protected] 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
[[email protected] samba]#
iptables -F 关闭防火墙
#Windows登录samba服务器
创建文件,创建目录
Linux挂载samba服务器
[email protected]>~$ sudo mount -t cifs //172.16.20.139/MyShare ~/samba/ -o username=samba_user1,password=samba_user1
[email protected]>~$ mount | grep "172.16.20.139"
//172.16.20.139/MyShare on /home/linuxidc/samba type cifs (rw)
[email protected]>~$ cd /home/linuxidc/samba/
[email protected]>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
------------------------------------分割线------------------------------------