Install and configure Samba in centos 7

Source: Internet
Author: User

Recently, I want to use RedHat Linux as a learning platform, but it is too difficult to download the RedHat Linux ISO file. Because centos and RedHat Linux are extremely similar, it takes more than 30 minutes to download the centos Linux 7 dvd iso. This image has more than 4 GB images.

There are a lot of articles about Samba configuration on the network, but none of them can be implemented by following the instructions. So I decided to write a complete configuration. Although security cannot be guaranteed, functions can be implemented and security will be further studied.

  1. Install

I will not elaborate on the installation process. Baidu has a lot of documents. I believe anyone with a little Linux foundation can install it. I installed it twice and used the min install command for the first time. After installation, I found that the ifconfig command could not run.

No file is found when which ifconfig or find/-name "ifconfig *. *" is run.

I found a lot on the Internet, and some said there were no environment variables. The files were in the bin or sbin.

The correct solution is to run the following command:

# Yum install net-Tools

The reason is that ifconfig is out of date and can be queried using ip addr or IP link.

I chose file and printer server mode again to avoid interference. In this mode, you can run the ifconfig command.

2. Install samba

Run the following command:

# Yum-y install samba-client samba-common

After the installation is complete, run rpm-Qa | grep "Samba" to ensure that the installation is successful.

650) This. width = 650; "Title =" 1.jpg" alt = "wkiom1qnyn3im3qmaaceg_dni6q211.jpg" src = "http://s3.51cto.com/wyfs02/M00/4B/07/wKiom1QnyN3im3QMAACEg_dNi6Q211.jpg"/>

3. Configure samba

Suppose we have such a scenario

Share Name Path Permission
Sharedoc /SMB/docs All personnel, including guests, can access
Rddocs /SMB/Tech Allow read/write access only to users in a specific group
Preparations: Create a shared directory /smb Files in the directory) # mkdir -p /smb/docs # mkdir -p /smb/tech   // Create an operating system user # useraddalice # useraddjack # useradd tom # useradd RD     // Modify user group # usermod -a-G RD alice # usermod -a-G RD jack # usermod -a-G RD tom After the account is created, check the user's group to ensure that each user has a 1003 Rd # id alice uid=1000(alice) gid=1000(alice) groups =1000(alice),1003(RD) # id jack

uid=1001(jack) gid=1001(jack) groups =1001(jack),1003(RD) # id tom

uid=1002(tom) gid=1002(tom) groups =1002(tom),1003(RD) # id RD

uid=1003(RD) gid=1000(RD) groups =1003(RD)   // Modify Directory Permissions # chgrp RD /smb/tech # chgrp RD /smb/docs # chown RD /smb/tech # chown RD /smb/docs # chmod 770 /smb/tech # chmod 770 /smb/docs   Check the folder permissions after modification. # ls /smb -l    // Back up the original configuration file in the original directory # cd /etc/samba # cp smb.conf smb.conf.origin     # vi/etc/samba/smb.conf Delete all original content and add the following content: [global]    workgroup=BIGCLOUD    netbios name=ZZSRV2    server string=Samba Server    #security=share    security=user    map to guest = Bad User [SHAREDOCS]    path= /smb/docs    readonly = yes    browseable= yes    guest ok= yes [RDDOCS]    path =  /smb/tech/    public = no    writable =  yes      write list = @RD    validusers = @RD

4. Restart the service

RedHat liunx is restarted with service restart SMB, and all service operations in centos are completed with systemctl.

Run the following command:

# Systemctl restart SMB

# Systemctl reload SMB

# Systemctl status SMB

The last command is to check the status.

650) this.width=650;" title="2.JPG" alt="wKioL1Qn0hnxC41_AANT1o1nrS8028.jpg" src="http://s3.51cto.com/wyfs02/M00/4B/0B/wKioL1Qn0hnxC41_AANT1o1nrS8028.jpg" />

 

5. Firewall and SELinux

This is basically not mentioned in the article on the Internet, so I have never been successful in the test. I finally found that SELinux and the firewall can be accessed after being disabled.

Disable Firewall

650) This. width = 650; "Title =" 3.jpg" alt = "wKiom1Qn046hB80lAADU-iQnisI052.jpg" src = "http://s3.51cto.com/wyfs02/M02/4B/0A/wKiom1Qn046hB80lAADU-iQnisI052.jpg"/>

Disable SELinux

650) This. width = 650; "Title =" 4.jpg" alt = "wkiom1qn06fydr1jaahsk1shxvy267.jpg" src = "http://s3.51cto.com/wyfs02/M00/4B/0A/wKiom1Qn06fydR1JAAHsK1ShxVY267.jpg"/>

 

7. client group

The machine I successfully tested is a Windows 7 machine in the workgroup Working Group, and the machine that is added to the domain cannot be accessed. This may be related to the previous setting of workgroup in Samba.

 

 

This article is from the IT sharing blog, please be sure to keep this source http://jeromexiong.blog.51cto.com/1108120/1559129

Install and configure Samba in centos 7

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.