Centos 7 Samba service is installed

Centos 7 Samba service is installed
to build Samba Linux server to achieve after the shared directory on Windows can access the shared directory directly.


View samba package is already installed :

rpm -qa | grep samba
------------------------------------
samba-common-4.8.3-4.el7.noarch
samba-client-libs-4.8.3-4.el7.x86_64
samba-client-4.8.3-4.el7.x86_64
samba-common-libs-4.8.3-4.el7.x86_64
------------------------------------

Here are all installed packages samba, samba service but now is not yet installed.

Samba installation services

yum install -y samba

Using yum automatically detects installation is required because the installation and installation dependent.

Dependencies Resolved

============================================================================================================
 Package                          Arch                 Version                     Repository          Size
============================================================================================================
Installing:
 samba                            x86_64               4.8.3-4.el7                 base               680 k
Installing for dependencies:
 pytalloc                         x86_64               2.1.13-1.el7                base                17 k
 samba-common-tools               x86_64               4.8.3-4.el7                 base               448 k
 samba-libs                       x86_64               4.8.3-4.el7                 base               276 k

Transaction Summary
============================================================================================================

 

Samba configuration
At this point, we have Samba installed, now Samba configuration.

  •  Close selinux Service

The service does not cause a shut down Windows does not have access
temporarily closed

setenforce 0 (only for the current active after the restart, the service will be restarted.)

 

Permanently closed

Open selinux configuration file:

vi /etc/sysconfig/selinux

 

The SELINUX = enforcing modify SELINUX = disabled

#This file controls the state of 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
#SELINUXTYPE= can take one of these two values:
#targeted - Targeted processes are protected,
#mls - Multi Level Security protection.
SELINUXTYPE=targeted

Reboot: reboot

 

  • Create a shared directory

New shared directory in the home directory

mkdir /home/share

Given directory permissions

chmod 777 /home/share

 

  •  Add samba server users

First create a normal user

fenxiang adduser 
passwd fenxiang

Add the user to the samba service list

-a fenxiang the smbpasswd 
------------------------
New SMB password:
the Retype new new SMB password:
Added the User fenxiang.
--------- ---------------
appear added user * represents added successfully

 

 

  • Modify the Samba configuration file


First, back up the Samba configuration file:

cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 

Open the configuration file:

vi /etc/samba/smb.conf 

the following modifications:
Security = the User
# here is to set the samba share level, share represents a share-level access, the server does not perform client authentication, user represents a user-level access, servers are accessible samba to authenticate the client

In the config file add the following:

[Share] 
Comment = My Share 
# description of the shared resource 
path = / Home / Share 
# shared resource path 
Valid User = fenxiang 
# settings allow shared access to a list of users or groups 
Writable = Yes 
# whether the specified shared path write 
browseable = yes 
# if you can browse the shared directory of 
the create the MODE = 0777 
# specify the client creates the default permissions on the file in a shared directory 
directory the MODE = 0777 
# specify the directory to create a file sharing client default directory permissions

Save and exit

 

  • Turn off the firewall
Turn off the firewall 
systemctl stop firewalld 
turn off the firewall boot 
systemctl disable firewalld

 

  •  Start samba service
Open service 
systemctl Start smb 
systemctl Start nmb 
will be added to the service start-up in 
systemctl enable smb 
systemctl enable nmb

 

  •  Windows Access

 

Guess you like

Origin www.cnblogs.com/pwswaitfor/p/10967821.html