Create a Samba File Sharing Server
Samba files are shared with printers and supported across platforms
Disable selinux, disable iptables or iptables, and execute the following command:
Iptables-I RH-Firewall-1-INPUT 5-m state -- state NEW-m tcp-p tcp -- dport 139-j ACCEPT
Iptables-I RH-Firewall-1-INPUT 5-m state -- state NEW-m tcp-p tcp -- dport 445-j ACCEPT
Iptables-I RH-Firewall-1-INPUT 5-p udp-m udp -- dport 137-j ACCEPT
Iptables-I RH-Firewall-1-INPUT 5-p udp-m udp -- dport 138-j ACCEPT
Iptables-save
Service iptables restart
1. Use the yum tool for installation on a machine that can be connected to the Internet. if the machine is not connected to the Internet, mount the system disk for installation.
# Yum install samba-client samba-swat-y
The dependent packages samba-common, samba-winbind-clients, and libsmbclient are automatically installed.
2. Check the installation status.
Rpm-qa | grep samba
Samba-winbind-clients-3.6.23-14.el6_6.x86_64
Samba-3.6.23-14.el6_6.x86_64
Samba-common-3.6.23-14.el6_6.x86_64
Samba-client-3.6.23-14.el6_6.x86_64
Samba4-libs-4.0.0-55.el6.rc4.x86_64
Samba-winbind-3.6.23-14.el6_6.x86_64
Samba-swat-3.6.23-14.el6_6.x86_64
3. Installation Package Description
Samba-common-3.5.10-125.el6.x86_64 // mainly provides the setup file and Setup File Syntax validation program testparm for the samba server
Samba-client-3.5.10-125.el6.x86_64 // client software, mainly provides linux host as the client, the required tool instruction set
Samba-swat-3.5.10-125.el6.x86_64 // https-based samba Server web configuration interface
Samba-3.5.10-125.el6.x86_64 // server software, mainly providing samba server daemon, sharing documents, log rotation, boot default options
Samba-winbind-clients-3.5.10-125.el6.x86_64 basic components
After the Samba server is installed, the configuration file directory/etc/samba and other samba executable command tools,/etc/samba/smb will be generated. conf is the core configuration file of samba,/etc/init. d/smb is the startup/Close file of samba.
4. Start the Samba server
You can start, disable, and restart the Samba service through/etc/init. d/smb start/stop/restart.
5. View samba service startup status
# Service smb status
6. Set auto-start upon startup
# Chkconfig -- level 35 smb on // automatically runs the samba service at levels 3 and 5
Ii. Configuration File Modification
Back up the configuration file
Cp/etc/samba/smb. conf/etc/samba/smb. conf. bak
Enter the configuration file vim/etc/samba/smb. conf.
1. Set common parameters globally
[Global]
Displays charset = UTF-8
Unix charset = UTF-8
Dos charset = cp950 // the above three lines are used to prevent garbled characters
Workgroup = WORKGROUP indicates the working group in which the share is located
Server string = Name of the Server displayed on the Samba server Client
Netbios name = share file of samba Windows description
Security = share: the user name and password are not provided. There are three methods to share | domain | share and user are commonly used. user provides the user name and password.
Hosts allow = 192.168.2. 192.168.1. Host t 192.168.1.10 allows access from the 192.168.2.0 and 192.168.1.0 segments, EXCEPT for the host 192.168.1.10 (Note: Separate multiple network segments with spaces)
Hosts deny = 192.168.2.5 deny access to 192.168.2.5 (Note: deny takes effect first when used together with allow)
Smb passwd file =/etc/samba/smbpasswd specifies the location of the samba Password file
Log file =/var/log/samba/% m. log default log file. % m records logs respectively by host name
Max log size = 50 the default log size is 50 K
2. Common Parameters for user shared files
[Forshare] the file name is shared in brackets.
Commont = shared description
Path = shared file path
Public = yes | no whether anonymous access is allowed
Guest OK = yes anonymous users log on as guest;
Browsable = yes | no whether shared files are visible
Read only = yes | no is read-only
Writable = yes | no is writable
Write list = user name, user, @ group name: user who sets the read permission
Valid users = user name or @ group name
Invalid users = user name or @ group name setting invalid user
Create mask = 0644 set the permission for creating a file
Directory mask = 0755 Set permissions for creating folders
Iii. samba example
[Global]
Workgroup = WORKGROUP
Netbios name = Liukai
Server string = Liukai's Samba Server
Security = user
[Test]
Path =/opt/test
Writeable = yes
Browseable = yes
Public = no
4. Create shared files and login usernames
Mkdir share
Chmod 755 share
Useradd test1
Password text1 ....
The password of Smbpasswd-a test1 cannot be the same as the System Login Password
5. Access Samba server sharing;
1. in Linux, you can use the following command to access it;
[Root @ localhost ~] # Smbclient-L // liukai or smbclient // 192.168.0.94/test
Password:
2. In Windows, you can use the following methods to access the service;
\ Liukai or \ 192.168.0.94
3. Note: If netbiosname is used, it cannot be accessed by the host name. If netbiosname is not used, it can be accessed by "\ host name.
Vi. samba Environment Variables
% S = current service name (if any)
% P = root directory of the current service (if any)
% U = User Name of the current service (if any)
% G = the active working group that the current user says is in
% U = User Name of the current Dialog
% G = Main workgroup of the user in the current Dialog
% H = Home directory of the current service user
% V = Samba service version.
% H = Host Name of the machine running the Samba Service
% M = client NETBIOS Name
% L = server NETBIOS Name
% M = client host name
% N = NIS server name
% P = The Home Directory of the NIS Service
% R = protocol level used (value can be CORE, COREPLUS, LANMAN1, LANMAN2, NT1)
% D = ID of the current service process
% A = client structure (only Samba, WfWg, WinNT, and Win95 can be identified)
% I = Client IP % T = current date and time
------------------------------------ Split line ------------------------------------
How to share files with Samba in Ubuntu 14.04
The speed of accessing samba from Ubuntu dual Nic of VMWare Virtual Machine doubles
Add the Samba File Sharing Server to the Windows Server 2003 Domain
Samba installation Configuration
Samba service configuration in CentOS 6.2
Samba Server installation and configuration
How to Build the Win7 + VMware + Fedora18 Samba Server
------------------------------------ Split line ------------------------------------
Samba details: click here
Samba: click here
This article permanently updates the link address: