1 Installing Samba
[[email protected] ~]# yum–y install samba← network installation of Samba
Yum-y Install Samba-client//client and some management tools, including SMBPASSWD
2 Adding Samba Users (user name "Samba")
[[email protected] ~]# adduser samba← Add user Samba (System automatically creates Samba folder under/home)
[[email protected] ~]# smbpasswd-a samba← Add System User Samba to the Samba user database
New SMB password:← Enter the password that the user uses to log in to Samba
Retype new SMB password:← confirm entering this password again
3 Configuring Samba
[[email protected] ~]# cd/etc/samba/← into the Samba configuration directory
[[email protected] ~]# CP smb.conf smbbak.conf← before modifying the Samba configuration file, first back it up (a good habit)
[[email protected] ~]# vi/etc/samba/smb.conf← open configuration file
Need to be modified:
Workgroup = Workgroup//Set Workgroup Security = share//safety level, user requires username and password, share level does not
Need to add:
[Jimmy]//Create a share named Jimmy Sharing, the name is arbitrary, but behind windows will use comment = Samba//description information, the same casual
Path =/home/jimmy/share//shared path, requires access
Public = yes/allow Guest user access (equivalent to guest OK = yes/no)
writable = yes/not writable
To create a shared directory:
Mkdir/home/jimmy/share
Assigning permissions:
chmod 777/home/jimmy/share
I added the following at the end of the configuration file: (Personal Settings)
[Samba]
Comment = Samba←samba description
Path =/home/samba← shared directory
public = no← whether to allow Guest user access (equivalent to guest OK = yes/no)
writable = yes← is writable
browseable = yes← is allowed to browse (the line can not be written)
Valid users = @samba ← Access User (can have multiple, such as: @samba @testuser ... )
4 Open firewall port
[[email protected] ~]# cd/etc/sysconfig/← into the firewall configuration directory
[[email protected] ~]# CP iptables iptablesbak← before modifying the port profile, first back it up (a good habit)
[[email protected] ~]# vi/etc/sysconfig/iptables← open configuration file
Include the following in 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
[[email protected] ~]#/etc/rc.d/init.d/iptables restart← Restart Iptables to make the new rule effective
Flushing firewall rules: [OK]
Setting chains to Policy Accept:filter [OK]
Unloading iptables modules: [OK]
Applying iptables firewall rules: [OK]
Or
The consequence of shutting down the firewall//is that Windows does not see the native
Systemctl Stop FIREWALLD//Temporarily turn off the firewall
Systemctl Disable FIREWALLD//boot disabled
5 Start Samba service with two daemons: SMB NMB
[Email protected]/]# systemctl restart Smb.service nmb.service
6 Turn off SELinux
[Email protected]/]# Vi/etc/selinux/config
# This file controls the state of the SELinux on the system.
# selinux= can take one of these three values:
# Enforcing-selinux security policy is enforced.
# Permissive-selinux Prints warnings instead of enforcing.
# disabled-no SELinux policy is loaded.
selinux=disabled//modified to Disabled
# selinuxtype= can take one of these the values:
# targeted-targeted processes is protected,
# Minimum-modification of targeted policy. Only selected processes is protected.
# Mls-multi level Security protection.
selinuxtype=targeted
7 See if Fedora installs Samba successfully
[Email protected]/]# Rpm-qa |grep Samba
samba-libs-4.1.14-1.fc20.i686
samba-client-4.1.14-1.fc20.i686
samba-4.1.14-1.fc20.i686
samba-common-4.1.14-1.fc20.i686
The above information indicates that Samba installation was successful
8 Testing Samba
Open windows run \ \ (the IP address of Linux) \ (the share name added in smb.conf)
such as: \\192.168.2.146\samba
You may be prompted for no permissions or access, because selinux restricts the sharing of samba, so individuals take selinux off. (If you are prompted to "don't find it, check your spelling" Turn off the firewall #service iptables stop)
Close method: Open/etc/selinux/config
Modified: selinux=disable Restart Linux in effect
OK, all that's left is a mapped network drive under Windows, small case, right?
Configuring the Samba server under Fedora 20