A, why
Up is not satisfied with the samba service function provided by the soft routing system (speed fluctuation + frequent disconnection 😤), so it decides to build a Samba server using the Linux system to meet the requirements of file sharing on the LAN. There is no history of how the Samba server works, but if you are interested, you can search for it.
2. Environment introduction
The basic configuration of the UP host is as follows:
- CPU: Intel 3865 u
- Memory: Samsung DDR4 4GB✖️2 2133mhz
- Storage: Samsung MSATA 500G + 500GB Seagate machinery
Esxi6.7 creates a virtual lede routing system for CentOS 7.
Three, goals,
Use that 500GB Seagate hard drive as a repository, where all data will be stored in the future 😬 all user devices (including mobile phones, pads, computers) within the LAN can access the data setting permissions, only allowing users to log in to access
3. Disk mounting
Procedure 1 Check whether the system has detected the hard disk
usingfdisk -l
Command viewThis mechanical hard disk has been detected 😬
2 partitions
2.1 Partition Requirements
One primary partition 300GB + one extended partition (one logical partition 200GB) command fdisk /dev/sdb
2.2 partition
To use:fdisk /dev/sdb
The main steps of command partitioning are shown in the figure below:
2.3 the formatting
MKFS -t etx4 /dev/sdb1 mounts to/MNT /hd
2.4 mount
Mount sdb1 to/MNT /hd First create the hd folder mkdir/MNT /hd under/MNT, then run mount /dev/sdb1 / MNT /hd
2.5 Automatic Mounting
mount /dev/sdb1 /mnt/hd
Commands can only be temporary. Once the system restarts, the mount is dead, and we need to use itvim /etc/fstab
Modify the configuration file.Do use itmount -a
If no error message is displayed, the configuration file is successfully mounted
2.6 Checking the Mounting
df -h
Command to check whether the vm has been mountedLook, /dev/sdb1 has been mounted to/MNT /hd
4. Configure the Samba service
1 Install the Samba service
Yum install -y samba yum install -y samba
2 the samba configuration
Go to /etc/samba/smb.conf to edit the configuration
- Comment = XXX indicates text prompt, regardless
- Path = / MNT /hd indicates the shared file path
- Valid Users = xzy Users that only Xzy users are allowed to access
- Browserable = Yes browsable
- Writable = Yes Writable
- Read only = Yes Non-read-only
- Guest OK = No
3 Add the Samba user using pdbedit
Remember, before you add a Samba user, you have to have that user on your system using the pdbedit -a username, and then you can look at that Samba user pdbedit -l
4 Enable the Samba service
systemctl restart smb
Start the Samba service,netstat -tunlp | grep smb
The SMB service is started if port 445 is displayed inYou can also run the service SMB status command to check whether the Samba service is started5 Configure the firewall. In this case, you cannot connect to the Samba service on the client. Therefore, you need to configure firewall rules. To configure a firewall on centos 7, run the following command
- Check whether the firewall is enabled:
systemctl status firewalld.service
- Open port 445 (permanent) :
firewall-cmd --add-port=445/tcp --permanent
- View firewall rules:
firewall-cmd --list-all
Check result is successful, my MAC can access the connection normally
Unfortunately, my interface is 100 MB, the highest speed can only about 12MB, can not play the maximum transmission speed of the hard disk, but compared to opNWRT to start the service, stable a lot of, will not appear after dropping off the line not always connected to the situation, self-use more than 😬
At the end
Write a blog for the first time, have what wrong place, hope each big guy many advice 👻👻👻