Samba server notes (1), samba server notes
Samba Installation
Samba: main service package; samba-client: client; samba-common: common tool; samba4-libs: Library; samba-winbind: windows Domain ing; samba-winbind-clients: domain ing client
Samba daemon (Samba has two processes)
◆ Smbd: Provides shared access to files and print resources on the server by 139
◆ Nmbd: Provides resolution 137 138 Based on netbios Host Name
Both processes must be started.
[Xiaofeng @ localhost Packages] $Service smb startEnable the smb service
[Xiaofeng @ localhost Packages] $Service nmb startEnable nmb Service
[Xiaofeng @ localhost Packages] $Netstat-tlunView port status
{-T | -- tcp} tcp protocol {-u | -- udp} udp protocol
-L, -- listening display listening server sockets display listening service socket
-N, -- numeric don't resolve names does not parse the name
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
Tcp 0 0 0.0.0.0: 139 0.0.0.0: * LISTEN
Tcp 0 0 0.0.0.0: 111 0.0.0.0: * LISTEN
Tcp 0 0 192.168.122.1: 53 0.0.0.0: * LISTEN
Tcp 0 0 0.0.0.0: 22 0.0.0.0: * LISTEN
Tcp 0 0 127.0.0.1: 631 0.0.0.0: * LISTEN
Tcp 0 0 127.0.0.1: 25 0.0.0.0: * LISTEN
Tcp 0 0 0.0.0.0: 445 0.0.0.0: * LISTEN
Tcp6 0 0: 139: * LISTEN
Tcp6 0 0: 111: * LISTEN
Tcp6 0 0: 22: * LISTEN
Tcp6 0 0: 1: 631: * LISTEN
Tcp6 0 0: 1: 25: * LISTEN
Tcp6 0 0: 445: * LISTEN
Udp 0 0 0.0.0.0: 5353 0.0.0.0 :*
Udp 0 0 127.0.0.1: 323 0.0.0.0 :*
Udp 0 0 0.0.0.0: 30560 0.0.0.0 :*
Udp 0 0 192.168.122.1: 53 0.0.0.0 :*
Udp 0 0 0.0.0.0: 67 0.0.0.0 :*
Udp 0 0 0.0.0.0: 68 0.0.0.0 :*
Udp 0 0 0.0.0.0: 45127 0.0.0.0 :*
Udp6 0 0: 1: 323 :::*
Udp6 0 0: 19501 :::*
Common files
◆/Etc/samba/smb. conf
# Configuration file
◆/Etc/samba/lmhosts
# Files corresponding to the NetBIOS Name and Host ip address. Generally, samba will automatically search for files (only effective for local hosts)
◆/Etc/samba/smbpasswd
# Samba password to save the file, which does not exist by default
◆/Etc/samba/smbusers
# User alias, used to apply the user name habits that cannot be used in the operating system. The "username map" option in the configuration file must be supported.
◆ Testparm
# Check whether the configuration file is correct
[Xiaofeng @ localhost Packages] $ cat/etc/samba/smb. conf | grep-v "^ #"
In the grep regular expression, "-v" indicates the inverse, and "^" indicates the content starting with xx. The whole sentence indicates the content of smb. conf in reality, excluding all rows starting.
To enable the client to accessSambaThe server must firstSelinuxFirewall is disabled!
The configuration file for disabling selinux firewall is in/etc/selinux/config. modify it to SELINUX = disabled and restart it to take effect! You can use the sestatus command to view the status of SELinux status.
Configuration file structure
◆ Global Settings
-[Golbal]: global settings
◆ Share Definitions
-[Homes]: user directory sharing settings
-[Printers]: printer sharing settings
-[Myshare]: Set the shared directory with the custom name