Overview
Samba is a free software that implements the SMB protocol on Linux and UNIX systems, consisting of servers and client programs. SMB (Server Messages block, information service blocks) is a kind of communication protocol for sharing files and printers on LAN, which provides shared services of files and printers among different computers in LAN. The SMB protocol is a client/server protocol that allows clients to access shared file systems, printers, and other resources on the server. By setting up "NetBIOS over TCP/IP", Samba will not only share resources with local network hosts, but also share resources with computers around the world.
Samba Main applications
File sharing
Print server
Samba Login Authentication
Can perform host name resolution for Windows
Experimental environment
Windows7
Server-side IP address: 192.168.1.77 (Linux)
Client-side IP address: 192.168.1.10 (Windows7)
Yum Mount directory:/mnt/sr0
Using the RPM package :Samba: Master server package
Samba-client: Client (can do both server side and client)
Samba-common: General Tools
Samba4-libs: library file
Samba-winbind:windows Domain Mappings
Samba-winbind-clients: Domain Mapping Client
Build steps
First, access using the share level
1. Server-side Install Samba service RPM package
[Email protected] ~]# Rpm-qa | grep Samba #查看系统已安装的samba的软件包
[Email protected] ~]# cd/mnt/sr0/packages/[[email protected] packages]# RPM-IVH samba-3.6.9-164.el6.x86_64.rpm #安装主包
2, modify the configuration file _ Global Settings
[[email protected] ~]# Cd/etc/samba/[[email protected] samba]# CP smb.conf Smb.conf.bak #备份配置文件 [[email protected] samba]# Grep-v ' # ' smb.conf > smb.conf #重新过滤配置文件
[Email protected] samba]# vim smb.conf
3. Modify configuration file Sharing settings
[Email protected] ~]#/ETC/INIT.D/SMB start #启动smb服务
4. Create a shared directory
[Email protected] ~]# mkdir/tmp/pub[[email protected] ~]# chmod 777/tmp/pub/#其他人也可以对共享目录拥有上传权限
[Email protected] ~]# Cd/tmp/pub/[[email protected] pub]# echo "This is Test" > Test.txt #写入测试信息
5. Virtual Machine Login Access
6. Samba Server View anonymous user upload file
Second, access using the user level
1, modify the configuration file _ Global Settings
[Email protected] ~]# cd/etc/samba/[[email protected] samba]# vim smb.conf
2, modify the configuration file _ System User Directory Access settings
[Email protected] ~]#/ETC/INIT.D/SMB restart #启动smb服务
3. Create System user Directory Access directory
[Email protected] ~]# mkdir/tmp/vip[[email protected] ~]# chmod 777/tmp/vip/
4. Add system user and set Samba password
[[email protected] ~]# useradd zhangsan[[email protected] ~]# passwd zhangsan[[email protected] ~]# smbpasswd-a Zhangsan #设置samba密码, log in with Samba password to ensure the security of the system
[[email protected] ~]# useradd lisi[[email protected] ~]# passwd lisi[[email protected] ~]# smbpasswd-a Lisi
[[email protected] ~]# useradd wanger[[email protected] ~]# passwd wanger[[email protected] ~]# smbpasswd-a Wanger
[Email protected] ~]# pdbedit-l #查看设置samba密码的用户
5, Login Zhangsan user test
6, Login Lisi user test
7, Login Wanger user test
8. View Upload File
9. Modify Samba alias file
[Email protected] ~]# vim/etc/samba/smbusers #samba别名文件
[Email protected] ~]# vim/etc/samba/smb.conf #添加samba别名文件路径
[Email protected] ~]#/ETC/INIT.D/SMB restart
10. Hide Home Directory
Detailed Linux installation configuration Samba server for file sharing