Objective
It has always been thought that FTP and NFS are common ways to share local area network files, but after a recent contact with Samba, I learned that some users need to simplify access to learning costs, to meet the basic rights control management, and to support real-time editing and saving files, I understand that these requirements before using the method is difficult to meet, While Samba can perfectly support these needs, although it takes some time to learn when it comes to contact, it's easy to sort out the configuration and grammar.
One of the best ways to share Unix with Windows files
Update history
July 11, 2015-First draft
Read the original-http://wsgzao.github.io/post/samba/
Extended Reading
samba-https://www.samba.org/samba/docs/man/samba-howto-collection/
Samba Server-http://vbird.dic.ksu.edu.tw/linux_server/0370samba.php
RHEL6.5 deployment of Samba Enterprise file server combat-http://yuan2.blog.51cto.com/446689/1588085
Installing Samba
The installation of each platform is quite simple, skip
Configure Samba
It is recommended that you properly plan your directory and user rights, and you can use user groups to simplify authorization management, see extending reading
#创建目录 (example)Mkdir-p/data2/smchmod-r777/data2/sm#添加用户 (example)Groupadd denglinguseradd-g dengling- S/sbin/nologin denglingsmbpasswd -ADengling#备份smb配置文件并编辑CD/ETC/SAMBACP smb.conf SMB.CONF.BAKVI smb.conf#全局参数[Global] Security = share Lanman auth = Yes log file =/var/log/samba/log.%m idmap config *: backend = TDB Guest OK = Yes hosts allow =127.,172.,192.168.1.,192.168.3. Cups options = raw#共享参数[Homes] Comment = Home directoriesReadonly = No browseable = No[sheji] Comment = Sheji Path =/data2/sm/sheji Valid users = Share, Shenwei, Xuwei, S Henjiamei, Humengchu, Rensiqiang, yeting, tongying, Jinbo, Zengfanan, FengpeisiReadonly = No Create mask =0775Directory mask =0775[Test] Comment = Sheji Path =/data2/sm/test Valid users = Test, test2, ShenweiReadonly = No Create mask =0775Directory mask =0775[Q2] Comment = Sheji Path =/data2/sm/q2 Valid users = Xuejia, Sungaoshuai, lujingjing, Huangsonghe, Yefei, Lvwen Han, Fangyuan, Zhanghuichen, Liuguofa, Xupeiyu, Yangpengfei, Lisuitao, Sunzhen, Shenwei, Xuwei, Shenjiamei, Humengchu, Ren Siqiang, Yeting, tongying, Jinbo, Zengfanan, Fengpeisi, Chenye, wuailing, Pengnan, Liangzhixue, Chenhong, Daimengyou, Wang Xiaoshuo, Zhoujian, Fenglu, Linlijun, Chenshuxian, Linzhimin, Yanyoushan, xiaguoying, Zhanghuanrong, Mayushu, xuyangjing , Guogaoyan, Huangyouyang, Jinzhibin, huyuqing, Shenxuemei, LiukuiReadonly = No Create mask =0775Directory mask =0775[Market] Comment = Sheji Path =/data2/sm/market Valid users = Zhanghuichen, Shenwei, Chenye, wuailing, Pengnan, Liangzhixue, Chenhong, Daimengyou, Wangxiaoshuo, xuyangjing, Chenshuxian, Linzhimin, caoling, Guogaoyan, Xiehaibo, Huangyouyang, Jinzhibin, huyuqingReadonly = No Create mask =0777Directory mask =0775[Market_finance] Comment = Sheji Path =/data2/sm/market_finance Valid users = Yangqiong, Shenwei, Chenye, Wuaili Ng, Pengnan, Liangzhixue, Chenhong, Daimengyou, Wangxiaoshuo, Xiehaibo, Gaofangjie, xuyangjing, Chenshuxian, Linzhimin, H Uangyouyang, Jinzhibin, huyuqingReadonly = No Create mask =0777Directory mask =0775[Shenwei] Comment = Sheji Path =/data2/sm/develop/shenwei Valid users = ShenweiReadonly = No Create mask =0777Directory mask =0775[Qijun] Comment = QJ Path =/data2/sm/homedir/qijun Valid users = QijunReadonly = No Create mask =0777Directory mask =0775Guest OK = No[wenyong] Comment = Sheji Path =/data2/sm/develop/wenyong Valid users = WenyongReadonly = No Create mask =0777Directory mask =0775[Wudi] Comment = Sheji Path =/data2/sm/develop/wudi Valid users = WudiReadonly = No Create mask =0777Directory mask =0775[Caijiannan] Comment = Sheji Path =/data2/sm/develop/caijiannan Valid users = CaijiannanReadonly = No Create mask =0777Directory mask =0775[Weiduani2] Comment = Weiduan path =/data2/sm/develop/raochao/Micro-terminal Valid users = WangfengReadonly = No Create mask =0777Directory mask =0775[Raochao] Comment = Raochao Path =/data2/sm/develop/raochaoReadList = Wangfeng, Xuwei, Shenjiamei, Chenxianzhe, Chenye, wuailing, liuyuting, Dainan write list = raochao[product] C omment = Product Path =/data2/sm/productReadonly = No Create mask =0777Directory mask =0777[Jinbo] Comment = JinchBo Path =/data2/sm/homedir/jinbo Valid users = JinboReadonly = No Guest OK = No[xiaoqiang] Comment = Xiaoqiang Path =/data2/sm/homedir/xiaoqiang Valid users = Xiaoqi AngReadonly = No Guest OK = no[share] Comment = share path =/data2/sm/homedir/share Valid users = share, market, Wal , Qijun, ZhanghuaReadonly = No
Start Samba
#常用选项[Shared_name] Path =# File system pathbrowseable = {Yes|no}# Is it possible to be foundpublic = {Yes|no}# Whether it can be read by everyoneGuest OK = {Yes|no}# Same as public Readonly = yes# is read-onlywriteable = yes# Is it possible to writeWrite list = user1, user2# writable User list@group, +group# writable Group ListValid users =# White ListInvalid users =# blacklist#检查语法Testparm#重启smb服务查看状态Service SMB Restartsmbstatus
Windows Client Access
Access Samba on 1.Windows
In computer, enter:\\xxx.xxx.xxx.xxx\
2.Windows disconnected samba sharing connection, it is not possible to choose to log off or restart
In the "start" → "Run" → "CMD" carriage Enter:net use * /del /y
3. Map a Samba-shared Linux directory to a drive letter for Windows
In the "Right-click computer" → "Map Network Drive" → "folder \xx. Xx. Xx. Xx\ "
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Using Samba to implement Linux and Windows file sharing practices