CentOS 6 yum 安装samba文件服务器

前端之家收集整理的这篇文章主要介绍了CentOS 6 yum 安装samba文件服务器前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


安装samba

chunli@CentOS->~$sudoyuminstall-ysamba
chunli@CentOS->~$sudoyuminstall-ysamba-client
chunli@CentOS->~$sudoyuminstall-ysamba-common
chunli@CentOS->~$sudoyuminstall-ysamba-winbind
chunli@CentOS->~$sudoyuminstall-ysamba-winbind-clients


创建samba用户的方式1

[root@CentOS~]#useraddshare#创建系统用户
[root@CentOS~]#smbpasswd-ashare
NewSMBpassword:share
RetypenewSMBpassword:share


创建samba用户的方式2

[root@CentOS~]#useraddsamba_user1
[root@CentOS~]#pdbedit-asamba_user1
newpassword:samba_user1
retypenewpassword:samba_user1


pdbedit -L #列出所有samba用户

pdbedit -L [username] 查看samba用户

pdbedit -Lv [username] 查看samba用户详细信息

pdbedit -X username 删除一个用户



创建文件目录存放路径,修改权限

mkdir/opt/smb
chmodo+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
logfile=/var/log/samba/log.%m
maxlogsize=50
security=user
smbpasswdfile=/etc/samba/smbpasswd
loadprinters=yes
cupsoptions=raw
createmode=0644
forcecreatemode=0644
directorymode=0755
forcedirectorymode=0755


[MyShare]
path=/opt/smb/
validusers=share,samba_user1
writable=yes


#重启samba服务

[root@CentOS~]#chkconfigsmbon
[root@CentOSsamba]#servicesmbrestart
ShuttingdownSMBservices:[OK]
StartingSMBservices:



#查看samba监听状态

[root@CentOSsamba]#netstat-utnlp|grepsmb
tcp000.0.0.0:1390.0.0.0:*LISTEN10510/smbd
tcp000.0.0.0:4450.0.0.0:*LISTEN10510/smbd
tcp00:::139:::*LISTEN10510/smbd
tcp00:::445:::*LISTEN10510/smbd
[root@CentOSsamba]#


iptables -F 关闭防火墙




#windows登录samba服务器

创建文件,创建目录

wKiom1j7HzmxdJ7aAABepq2vVTA247.png

wKioL1j7Hzqw5vN9AABogQ6EM0c147.png

wKiom1j7HzuCBLzVAABeJw28jfE835.png

wKioL1j7HzywvkhVAABqDlBxbaY094.png


Linux挂载samba服务器

chunli@CentOS->~$sudomount-tcifs//172.16.20.139/MyShare~/samba/-ousername=samba_user1,password=samba_user1

chunli@CentOS->~$mount|grep"172.16.20.139"
//172.16.20.139/MyShareon/home/chunli/sambatypecifs(rw)

chunli@CentOS->~$cd/home/chunli/samba/
chunli@CentOS->samba$touchtest.file
touch:无法创建"test.file":权限不够

用root用户可以执行挂载,root可以写入
原文链接:https://www.f2er.com/centos/377857.html

猜你在找的CentOS相关文章