1. Install samba
[Root @ localhost ~] # Yum-y install Samba plugin install Samba over the network
2. Add a samba user (named "Samba ")
[Root @ localhost ~] # Adduser Samba plugin Add User Samba (the system automatically creates the samba folder under/Home)
[Root @ localhost ~] # Smbpasswd-a samba plugin adds the System user Samba to the samba user database
New smb password: Login enter the password used by the user to log on to Samba
Retype new smb password: Confirm again to enter the password
3Configure samba
[Root @ localhost ~] # Run CD/etc/samba/scripts to enter the samba configuration directory.
[Root @ localhost ~] # Cp smb. conf smbbak. conf before modifying the samba configuration file, back up the file (a good habit)
[Root @ localhost ~] # Vi/etc/samba/smb. conf restart open the configuration file
Add the following content at the end of the configuration file:
[Samba]
Comment = Samba parse Samba description
Path =/home/samba folder shared directory
Public = No. Allow whether to allow access by the guest user (equivalent to guest OK = yes/no)
Writable = Yes writable
Browseable = Yes bytes whether browsing is allowed (this row can be left blank)
Valid users = @ Samba users (there can be multiple users, such as @ Samba @ testuser ......)
4. Open the firewall port
[Root @ localhost ~] # Cd/etc/sysconfig/firewall go to the firewall configuration directory
[Root @ localhost ~] # Cp iptables iptablesbak back up the port configuration file before modifying it (a good habit)
[Root @ localhost ~] # Vi/etc/sysconfig/iptables ← open the configuration file
Add the following content to the configuration file:
-A input-M state -- state new-m tcp-p tcp -- dport 139-J accept
-A input-M state -- state new-m tcp-p tcp -- dport 445-J accept
-A input-M state -- state new-m udp-p udp -- dport 137-J accept
-A input-M state -- state new-m udp-p udp -- dport 138-J accept
[Root @ sample ~] #/Etc/rc. d/init. d/iptables restart iptables to bring the new rule into effect
Flushing firewall rules: [OK]
Setting chains to policy accept: Filter [OK]
Unloading iptables modules: [OK]
Applying iptables firewall rules: [OK]
5. Start the samba Service (including two Daemon Processes: SMB nmb)
[Root @ sample ~] # Chkconfig SMB on startup
[Root @ sample ~] # Chkconfig -- list SMB restart confirm the samba startup tag and check that 2-5 is in the on status
SMB 0: off 1: off 2: On 3: On 4: On 5: on 6: Off
[Root @ sample ~] # Chkconfig nmb on startup
[Root @ sample ~] # Chkconfig -- list nmb enabled confirm the nmb startup label and confirm that 2-5 is in the on status (the test shows that SAMBA service is not affected even if all are off)
Nmb 0: off 1: off 2: On 3: On 4: On 5: on 6: Off
[Root @ sample ~] #/Etc/rc. d/init. d/SMB start restart start the samba Service
Starting SMB services: [OK]
[Root @ sample ~] #/Etc/rc. d/init. d/nmb start worker start nmb Service
Starting nmb services: [OK]
6Windows SAMBA service access
Enter // 192.168.0.8 (Samba Server IP address) to access the samba shared directory.
【※]
Question 1:When all configurations are normal, client access exceptions often occur (LOGIN fails or shared folders cannot be accessed ):
Cause 1: the samba ora firewall does not allow Samba port access.
Cause 2: you can disable the security subsystem SELinux in federa.
[Root @ localhost ~] # Setenforce 0 disable SELinux
Question 2:When logging on to Samba in windows, the system prompts that samba does not allow a user to use more than one user name to connect to a server or shared resource.
Solution: in windows, enter the command line "net use */del/Y" and log on to samba again.
Fedora9 Samba server set up
●Install samba
[Root @ localhost ~] # Yum-y install Samba installed through the network install samba
● Add Samba user (user name called "Samba ")
[Root @ localhost ~] # Adduser Samba plugin add users Samba (the system automatically to create Samba folder in the/Home)
[Root @ localhost ~] # Smbpasswd-a samba plugin Add the System user Samba into Samba user database
New smb password: Enter the user password used to log on Samba
Retype new smb password: enter the password again to confirm
● Configure samba
[Root @ localhost ~] # Cd/etc/samba/secrets enter Samba configuration directory
[Root @ localhost ~] # Cp smb. conf smbbak. conf modify the samba configuration file, first back it up (good habit)
[Root @ localhost ~] # Vi/etc/samba/smb. conf restart open the configuration file
Finally, in the configuration file Add the following contents:
[Samba]
Comment = Samba parse Samba description
Path =/home/samba secure shared directory
Public = no authorization whether to allow guest user to access (equivalent to guest OK = yes/no)
Writable = yes when whether to allow writing
Browseable = yes when whether to allow browsing (the bank can not write)
Valid users = @ Samba specify the allowed user to access (you can have more than one
Such as: @ Samba @ testuser ...)
● Open firewall ports
[Root @ localhost ~] # Cd/etc/sysconfig/login enter the firewall configuration directory
[Root @ localhost ~] # Cp iptables iptablesbak modify the port configuration file, first back it up (good habit)
[Root @ localhost ~] # Vi/etc/sysconfig/iptables restart open the configuration file
In the configuration file to add the following:
-A input-M State-State new-m tcp-p tcp-dport 139-j accept
-A input-M State-State new-m tcp-p tcp-dport 445-j accept
-A input-M State-State new-m udp-p udp-dport 137-j accept
-A input-M State-State new-m udp-p udp-dport 138-j accept
[Root @ localhost ~] #/Etc/rc. d/init. d/iptables restart iptables, the new rules take effect
Flushing firewall rules: [OK]
Setting chains to policy accept: Filter [OK]
Unloading iptables modules: [OK]
Applying iptables firewall rules: [OK]
● Start the samba services (including two daemons: SMB nmb)
[Root @ localhost ~] # Chkconfig SMB on your set Samba self-startup
[Root @ localhost ~] # Chkconfig-list SMB restart confirm the samba Startup tab status, 2-5 are on
SMB 0: off 1: off 2: On 3: On 4: On 5: on 6: Off
[Root @ localhost ~] # Chkconfig nmb on each set from the start nmb
[Root @ localhost ~] # Chkconfig-list nmb tables confirm the samba Startup tab status, 2-5 are on
(Test found that even if all of them are off does not affect the samba Service)
Nmb 0: off 1: off 2: On 3: On 4: On 5: on 6: Off
[Root @ localhost ~] #/Etc/rc. d/init. d/SMB start restart start the samba Service
Starting SMB services: [OK]
[Root @ localhost ~] #/Etc/rc. d/init. d/nmb start restart start nmb Service
Starting nmb services: [OK]
● Windows Access to Samba Server
Input // 192.168.0.8 (Samba Server IP) in run can access the samba shared directory.
【※]
Q1:Although everything is OK, clients often access exception (unable to successfully log in or can see but can not access shared folders, etc .):
1st reason: fedora firewall does not open Samba port.
2nd reason: Cause federa SELinux security subsystem, you can turn it off.
[Root @ localhost ~] # Setenforce 0 reset set SELinux off
Q2:When Login
Samba in windows, Windows warns that
Does not allow multiple users to access same share in Samba.
Solution: inputting the command line "net use */del/y" in Windows run, re-Login
Samba.