Centos7.4 / RHEL7.4 --- set up Samba server

lumen超cute
This link: https://blog.csdn.net/qq_45555226/article/details/102763468

- Training mission statement -

实训  配置与管理Samba服务器

First, the purpose of training

  1. Master resource sharing and exchange of visits between Linux and Windows method.
  2. Master the installation and configuration of Samba server.

Second, the project needs

Background: A company's technical department needs to add a Samba server as a file server, workgroup named Workgroup, published shared directory / share / tech, share name tech, this shared directory allows all employees to access technical department, allows browsing, to allow reading write, do not allow anonymous service.

三、实训环境

1. Systems and Software Environment
Operating System: CentOS 7 / RHEL7 (server), windows 7/10 / Server ( as client authentication)
2. Experimental configuration files and command
configuration file: *** profile
command: ifconfig, setup, vi etc.

Third, the training content

CentOS 7 / RHEL 7 as a server, can access the network, and can provide file sharing services Samba server;
Windows Server / Win7 as a client, can access the shared directory on CentOS 7 / RHEL 7 server;

Fourth, the training step

1. Install the samba server
① # rpm -qa | grep samba // query whether the samba installation
Here Insert Picture Description
// As shown above, the relevant packages are installed
// If there is no relevant packages, can mount CD-ROM, and then modify yum local source, can be installed. See in particular items 3 and 9

2. Re-install Samba
① mount the ISO installation image
#mkdir / iso // establish a mount point directory
mount / dev / cdrom / iso // mount the CD to the next / iso directory
Here Insert Picture Description

② backup yum original source
#cd / etc // switch to the / etc directory
#mkdir yum.repos.d.bak // create a backup folder to store yum source to back up
#mv yum.repos.d / *. yum repo yum.repos.d.bak // backup source
#ls yum.repos.d // view the backup effect
#ls yum.repos.d.bak // View backup effects
Here Insert Picture Description

③ prepared for installation yum source documents dvd.repo
Vim source configuration file // dvd.repo
Here Insert Picture Description
Here Insert Picture Description

④ use yum to see the samba package information
#yum info samba
Here Insert Picture Description

⑤ using the command yum install samba service
#yum clean all // First clear the yum cache
Here Insert Picture Description
#yum install samba -y // install samba service
Here Insert Picture Description
#rpm -qa | grep samba // see if installed
Here Insert Picture Description
⑥ open the samba service
#systemctl start smb / / open service
#systemctl status smb // check the status of
Here Insert Picture Description

3. Configure samba server
① the establishment of a shared folder / report this content share / Tech
#mkdir / report this content share / Tech -p // create the shared folder / report this content share
#touch /share/tech/test_tech.tar // create a test file
Here Insert Picture Description

② add users and groups tech technology department, and create a test user test_user1
# groupadd tech // establish technical groups, tech
# useradd-tech tech1 -g // build user tech1, and joined the technical team tech
# useradd-tech tech2 -g / / user tech2 established, and the technology to join the group Tech
# Useradd test_user1 // create a test user test_user1
#passwd tech1 // set a password for the user tech1
#passwd tech2 // set a password for the user tech2
#passwd test_user1 // set a password for the user test_user1
Here Insert Picture Description
③ add the corresponding Samba account for the technical members of the Department
#smbpasswd -a tech1
#smbpasswd -a tech2

Here Insert Picture Description

④ backup samba master configuration file
#cp /etc/samba/smb.conf /etc/samba/smb.conf.bak // the samba master configuration file backup
Here Insert Picture Description
⑤ configure samba master configuration file
#vim / etc / samba / smb .conf // edit the main configuration file
Here Insert Picture Description

// configuration information as follows:
Here Insert Picture Description
// if there is no write access, in the following line can read.only [Tech] added: Writable = Yes
⑥ local system set shared directory permissions
#chmod -R & lt 777 / Share / Tech
# -R tech1 chown: Tech / report this content share / Tech
#chown -R tech2: Tech / report this content share / Tech
Here Insert Picture Description
⑦ change the value of a shared context directory, or ban SELinux
#chcon -t samba_share_t / report this content share / Tech -R
or:
#getenforce
#setenforce Permissive
Here Insert Picture Description
⑧ open the firewall
# firewall-cmd --permanent --add-service = samba // the Samba added to the firewall to allow service
Here Insert Picture Description
# firewall-cmd --reload // reload firewall
Here Insert Picture Description
# firewall-cmd --list-all // Check the list of firewall, confirm Samba added to the firewall to allow the service
Here Insert Picture Description
to configure Samba ⑨ update service
systemctl reload smb // reload Samba service
Here Insert Picture Description
or
systemctl restart smb // restart the smb service

4. Test client access Samba shares (using win7 VMs)
① Type windows + R, enter: \ 192.168.97.110
with tech1 log on, create a test folder, whether the test can be written
Here Insert Picture Description
Here Insert Picture Description

Here Insert Picture Description
Here Insert Picture Description

The win ② cancellation system virtual machine
type windows + R, enter: \ 192.168.97.110
with test_user1 login, login failures found
Here Insert Picture Description
Here Insert Picture Description

(make it complete)

V. Submissions

1. The network parameter configuration and connectivity test shots 6 points
①samba server, the network configuration information centos7.4
Here Insert Picture Description
network client configuration information ②2k3
Here Insert Picture Description

③ test client connectivity and server-side:

Here Insert Picture Description
Here Insert Picture Description
2. Install the server and start a successful interface 6 points
Here Insert Picture Description
3. user or file settings Screenshot 6 points

Here Insert Picture Description
4. Main Configuration document theme 6 minutes
Here Insert Picture Description
5. Run the experimental result of step 6 theme points
① with tech1 login, whether the test write

Here Insert Picture Description

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
② with test_user1 login, login failures found

Here Insert Picture Description
Here Insert Picture Description

Six, scoring criteria

1. Submit time 60 minutes
2 30 content integrity
3. 10. Format Specification

Seven Questions

How to set up a specific network can not access the shared folders? ? ?
In [Tech] below the main configuration file, write the following two lines, to
hosts deny = 192.168.10. # 192.168.10 rejected. Samba network access server
hosts allow = 192.168.20. # 192.168.20 rejected. Samba network access server

Guess you like

Origin blog.csdn.net/qq_45555226/article/details/102763468