Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure a Linux Samba server

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "how to configure Linux Samba server". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The system environment is Ubuntu 7.04.

Since the server is set up, let's talk about the server-side configuration of Samba first. Because the system is Ubuntu, the software installation is automatically completed by the system after entering sudo apt-get install samba, which is quite convenient without considering the software dependence. After installing Samba, let's take a look at the configuration file of Samba and find / etc/samba/-- > ls. There are smb.conf and smbpasswd under the directory, in which smb.conf is the main configuration file, and smbpasswd is the user / password correspondence table. The execution files of Samba include smbd and nmbd (Samba startup daemons), testparm (check if the settings are wrong), smbpasswd (create password file), smbclient (check the directories and devices shared by the computer). Smbmount (mounting shared directories and devices). In addition, there are other related directories of Samba, such as log files, help documents, etc.

OK, let's start configuring smb.conf

[global] # Host Settings

Workgroup = workgroup name

Server string = host description

Netbios name = host name

Security = share (no secure login) | user (secure login, password file is related to smbpasswd) | domain (let Samba be the PDC)

Encrypt passwords = yes (enter password) | no (no password is required)

Smbpasswd file = / etc/samba/smbpasswd password file

Log file = / var/log/samba/log.%m log file, can be changed

Max log size = 0 log file size, 0 is unlimited, in KB

Load printers = yes

Printing = related to lprng printer

[Share Directory]

Comment = description of the directory

Path = the real directory corresponding to the share name

Read only = whether read-only

Public = whether to allow all users to log in

Whether writable= is writable, if read only=no and writable=yes, then writable shall prevail.

Create mode = create new file permissions

Directory mode = create new directory permissions

Well, these are the basic configuration instructions. Here are two examples to illustrate, hehe.

No right to limit directory sharing

First, the settings of the host:

[global]

Workgroup = frog studio

Server string = Ubuntu Samba Server

Log file = / var/log/samba/log.%m

Security = share

Encrypt passwords = no

(others are set by default)

Then there are shared directory settings:

[Share Directory]

Comment = My Share Directory

Path = / home/share

Read only = yes

Public = yes

Writable = yes

After the setup is complete, let's type testparm to test whether our settings are correct. If so, there will be a reminder. After confirming that there is nothing wrong, we need to restart our Samba server to make the settings take effect:

/ etc/init.d/samba restart

Next, let's do another self-test on the client:

Smbclient-L / / localhost

Then we can see the directory name we shared just now, Share Directory, hehe. Go to the Windows network neighbor and find it, and we can access the shared directory of Linux. Okay, let's increase our permissions:

Host settings

[global]

Workgroup = frog studio

Server string = Ubuntu Samba Server

Log file = / var/log/samba/log.%m

Security = user

Encrypt passwords = yes

Smbpasswd file = / etc/samba/smbpasswd

Shared directory settings

[Share Directory 2]

Comment = My Share Directory 2

Path = / home/share2

Writable = yes

Valid users =% S (those who have access)

Create mode = 0664

Directory mode = 0775

After the setup is complete, restart the Samba server again, but do not rush to windows for testing now, because this requires a user name and password. Let's first create a login user and password:

Useradd smb (create system user name)

Passwd smb (create system user password)

Smbpasswd-a smb (add a user to the password file)

# smbpasswd-d smb (suspend user login)

# smbpasswd-e smb (resume suspending users)

# smbpasswd-x smb (delete user)

For more operations, please refer to man smbpasswd

After creating the password file, test the Samba settings and testparm. After the test is normal, check our shared directory:

Smbclient-L / / localhost

This is the end of "how to configure Linux Samba Server". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report