Windows Network Neighbor file sharing protocol:
SMB/CIFS
SMB: Server Message Block
CIFS: Common Internet FileSystem
NETBIOS:
Windows host name resolution
Broadcast-style name resolution application WINS accelerates name resolution
Linux and unix File Sharing: NFS
Samba: It can simulate and implement windows SMB/CIFS and NETBIOS protocols on linux. As long as linux and unix support these three protocols, files can be shared between Linux, unix, and windows.
SAMBA: Provides SMB, CIFS, and NETBIOS protocols through software simulation in linux. You can impersonate linux as a client or server of SMB, CIFS, or NETBIOS. Therefore, starting samba enables mutual access to shared files in linux and windows. Linux can also be used as a windows Domain Controller.
Run netstat-an in windows to view the netbios listening port.
SAMBA process:
Nmbd: provides NETBIOS file resolution; listens to upd (137,138) tcp (139)
Smbd: FILE sharing; tcp (445)
Process not started by default:
Winbindd is used as a windows Domain client and is rarely used when it is bound to a windows Domain environment.
Samba configuration file
/Etc/samba/smb. conf/etc/samba/* (other files)
Script required to start the samba Service
/Etc/init/smb. start
Install SAMBA
Yum install samba (note: the samba installation package must be available in the yum source)
All configuration files are under/etc/samba.
Smb. conf file
# Note: Pure comment
; Note: Remove; indicates the option that can be enabled
View smb. conf configuration options
Grep-v "^ [[: space:] * #" smb. conf | grep-v "^ $" | grep-v "^ ;"
[Global] global configuration segment
Workgroup: Workgroup
Server string: Comment
Security: Security level;
Lowest share level, allowing anonymous users to directly access the shared directory
Each user must provide an account and a password for access.
The account and password are the samba account and password defined by the samba server itself.
Domain/server users' accounts and passwords are verified by a centralized account of a third-party server
Ads domain controller, generally the primary domain controller
Passdb backend password placement method
Load printers whether to load the printer at startup;
[Global] You can also define an access control list.
[Homes] configure each user to access the Home Directory through samba
Comment description
Browseable
Whether Writable (share permission) can be written
[Printer] independent shared segments
Comment-defined printer
Path print pool
[C_s] custom sharing
[] Is the shared name.
Custom sharing
For example, we share/share
Open Vim smb. conf
[Tools] (the shared name can be different from the shared directory name)
Comment = my Tools
Path =/share defines the real directory shared on the System
Browseable = yes
Guest OK = yes can be accessed by the guest account
Writable = yes
Write list = user name writable list (multiple users specify that only one user has the write permission)
Write list = @ or + group name (@ or + indicates the group). Define a user group with write permission.
Save and exit
Test the main configuration file of samba.
Note: You can set two IP addresses of different network segments for the samba service.
Enable Service
Service smb start
Automatic startup
Chkconfig smb on
View port
Netsrtat-tnlp
The samba account must be a system user, but the password is not the same
Add users to samba
Smbpasswd
-Add a to samba
-S: delete a user from samba
-D temporarily disable user access to samba
-E. Enable this user
Add a user to samba
Smbpasswd-a user name
Change the linux workgroup to the same name as windows.
Restart service
Service smb resrart
Access the samba server on the client
Modify the file system permission on the sabam Server
Setfacl-m u: User: rwx/shared directory
Smbcilent: a dedicated client tool for samba. Used to access and view resources shared by samba.
Smbcilent-l host (HOST ip)
View resources shared by the host
Smbcilent-l host (HOST ip address)-U username (username) view shared files of a HOST by a user
Access host shared resources on the client
Smbcilent // server ip/share name-U User Name
Define that service shared resources can only be accessed by specific clients:
Find the access control list hosts allow in Vim smb. conf and define the network address you want to allow.
Removed when enabled;
For example, hosts allow = 172. 192.168.12. 192.168.13.
Hosts allow = 172. 172.16.
Save and exit
Restart service
In addition, on the client, we can mount the samba shared directory to a local directory, but specify the file format cifs when mounting.
Mount-t cifs // IP/share name/mount point-o username = User Name
User Password
View Mount directory
Samba also has an interface for configuring samba Based on the graphic interface software samba-swat. Samba-awat is based on web pages and is a web server. Port 901 is used by default.
Install samba-swat
Yum install samba-swat
Samba-awat is a non-independent daemon and relies on super daemon.
Xinetd super daemon
Configuration files of non-independent daemon managed by super daemon
/Etc/xinetd. d
Edit awat
Open Vim swat
Service swat
{
Port = port 901
Socket_type = strenm indicates port tcp901
Wait = no
Only_from = 172.16.0.0./24 defines the swat Access Control List
User = root
Aerver =/usr/sbin/swat
Log_on_failure + = USERID
Disable = no do not disable swat
}
Save and exit
All non-independent Daemon must be managed by the super daemon.
Start swat
Service xinetd start
View port 901
Netstat-tnlp
Then you can log on to the browser.
This article is from the "Starry Night Rain" blog