SMB file sharing service built under Linux, Linux/windows interconnection

Source: Internet
Author: User

I. Introduction:
The SMB protocol is an application protocol built on the NetBIOS Protocol, a service based on TCP138, 1392 ports, and after NetBIOS, Microsoft uses NetBIOS to implement a network file/Print service system. This system sets up a set of file sharing protocols based on NetBIOS, which Microsoft calls the SMB (server Message Block) protocol, which is used in LAN Manager and Windows Server systems to enable sharing between different computers printers, files, and more. Therefore, the best way to integrate windows and Unix/linux computers is to install software that supports the SMB protocol on the Unix/linux computer. This way, clients using Windows do not need to change settings to use shared resources on the Unix/linux computer, as with Windows NT or Windows 2000 servers.

Samba runs the SMB protocol on the NetBIOS Protocol and uses the Windows NetBEUI protocol to allow the Unix/linux server to be accessed on the Windows Network Neighborhood.

     Samba的守护进程
    1. SMBD Monitoring 139 TCP port Settings shared directory, printing, etc.
    1. NMBD 137. 138 UDP port Management Group, NetBIOS and other parsing work

Second, the experimental topology

1.SMB Server: 192.168.1.1 Linux1
2.SMB Client: 192.168.1.2 Linux2
3.SMB Client: 192.168.1.3 Windows

Deployment on the server:

Close iptables to ensure interoperability

Knowledge points, Samba has four levels of security, namely:

Share: User does not need username and can log on to Samba server

User: Users need to enter a user name and password to log on to the Samba server

Server: Please check your own information, not commonly used, slightly

Domain: Please check the information yourself, not commonly used, slightly

[[email protected] ~]# yum-y Install Samba
[Email protected] ~]# vim/etc/samba/smb.conf

Find the [Global] area under workgroup = Workgroup Modify the group name under Windows
Security = User

Add a zone yourself below

[Share] Share name
Comment = SxS share description information
Path =/media/share Shared path
Guest OK = No whether guest access is allowed
Browseable = yes whether the shared directory is displayed
writable = yes whether write is allowed
Write list = SxS allows write users, @ for group

Options available
Host Allow = 192.168.80. 192.168.70.//Allow access to the server's host

Client code page = 939//Support Simplified Chinese share name

OK, Setup complete

[Email protected] ~]# Mkdir/media/share
[Email protected] ~]# Useradd SxS
[Email protected] ~]# chmod 755/media/share
[Email protected] ~]# chown Sxs.sxs/media/share
[Email protected] ~]# smbpasswd-a SxS
Enter Password two times
[[email protected] ~]#/ETC/INIT.D/SMB start related services
[[email protected] ~]#/ETC/INIT.D/NMB start

Because of the selinux problem, the purpose of the experiment cannot be achieved even if access is allowed in the file

Workaround: Turn off SELinux
[[email protected] ~]# Setenforce 0 Temporary shutdown method

Another solution: developing SELinux-related services for open samba

[Email protected] ~]# Getsebool-a | grep Samba
Samba_create_home_dirs--off
Samba_domain_controller--off
Samba_enable_home_dirs--off
Samba_export_all_ro--off
SAMBA_EXPORT_ALL_RW--off
Samba_portmapper--off
Samba_run_unconfined--off
Samba_share_fusefs--off
Samba_share_nfs--off
Sanlock_use_samba--off
Use_samba_home_dirs--off
Virt_use_samba--off

[Email protected] ~]#
#setsebool–p Samba_enable_home_dir on

#setsebool–p Samba_export_all_ro on

#setsebool–p SAMBA_EXPORT_ALL_RW on

Next Windows Test input: \192.168.1.1\share test into the shared directory, and write no problem

Let's test it on Linux.

[Email protected] ~]# yum-y install samba-client
[Email protected] ~]# smbclient//192.168.1.1/share-u SxS
Enter SxS ' s password:
Domain=[workgroup] Os=[unix] Server=[samba 3.6.9-164.el6]
SMB: \>

OK, Finish.

SMB file sharing service built under Linux, Linux/windows interconnection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.