A tutorial on configuring Samba servers on Linux systems

Source: Internet
Author: User
Tags auth command access iptables

First step:

Go to the/etc/samba directory, back up the smb.conf, then delete the file, rebuild one yourself, and enter the following

The code is as follows:

[Global]

Workgroup = Workgroup

NetBIOS name = www.e2fsck.org # Here's the focus, the name is best and machine name, remote access with this name

Server string = e2fsck is Samba server

Security = Share

Load printers = no #不加载打印机

Disable SPOOLSS = yes #隐藏打印机

Cups options = raw #打印机类型

Unix CharSet = UTF8

DOS CharSet =GBK

Display CharSet = UTF8

Client Lanman auth = yes

Client plaintext auth = yes

Hosts deny = 192.168.0.55 #阻止这个IP访问SMB

[Wujie]

Path =/var/wujie

writeable = yes

browseable = yes

Guest OK = yes

Briefly explain the above content [global] global configuration, must have. The first 3 lines are showing what is said, security if it is share is not the account password, if the user is to verify.

[Wujie] This is in the client display shared directory, path is shared path, the guest OK is yes is not authentication.

Step Two:

Create a folder in the/var/directory called Wujie to use for shared folders.

The code is as follows:

[Root@localhost ~]# ID Nobody

Uid=99 (nobody) gid=99 (nobody) groups=99 (nobody)

[Root@localhost ~]# chown-r Nobody:nobody/var/wujie

OK, then restart the SMB Server service SMB Restart and service NMB start a simple authentication-free shared server is done.

Step three: Make a shared server that requires an account password

1. First use the command useradd wujie-s/sbin/nologin (System to establish a call Wujie account and can not login system)

2. Then use the command smbpasswd-a Wujie (Use this command to add an SMB account called Wujie)

3. Chown Wujie:wujie/var/wujie (Allow Wujie account to have permission to use/var/wujie this directory)

4. Then modify the/etc/samba/smb.conf:

The code is as follows:

[Global]

Workgroup = Workgroup//To specify the NT domain name as described on your computer on the network

NetBIOS name = www.e2fsck.org//host name, used to access address, important

Server string = e2fsck is Samba server

Guest account = Wujie////If you want to create a number, fill in the username again and add the account in/etc/passwd, otherwise use the default ' nobody ' as your account

Security = User

This is the security level of the Samba server. The default is the user level. Samba has a total of 4 security levels.

1. Share level, shared security level, users do not need to enter the account number and password can be logged

2 User level, user security level, users need account number and password to log in

3. Server-level, security-level, password-checking work can specify another Samba server to complete

4 domain security level, you need to specify an XP and other server authentication user password

The code is as follows:

Unix CharSet = UTF8

DOS charset = GBK

Display CharSet = UTF8

Client Lanman auth = yes

Client plaintext auth = yes

The code is as follows:

[Wujie]

Path =/var/wujie

writeable = yes

browseable = yes

Guest OK = no//user needs password, yes no password required (need to match security level above)

Comment = Wujie

Valid users = Wujie//accessible user

public = no//anonymous user not visible

Create mask = 0777

The main thing is to change the security into user guest OK to No

5. Last service SMB restart and service NMB start this makes a shared file server with command access.

6. If you open the firewall

The code is as follows:

[Root@s ~]# iptables-a input-p tcp–dport 139-j

[Root@s ~]# iptables-a input-p tcp–dport 445-j

[Root@s ~]# iptables-a input-p udp–dport 137-j

[Root@s ~]# iptables-a input-p udp–dport 138-j

[Root@s ~]# iptables-a input-i lo-j ACCEPT

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.