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

What is the configuration of samba in linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

What is the configuration of samba in linux? I believe many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Samba is a very powerful cross-platform sharing service. I won't say any more nonsense here and go straight to the point. As the department has recently recruited new employees, today we put some frequently used software in our development department into sharing, and every time new employees come to share downloads directly. So on the server side (internal server, system redhat 6.1)

Purpose: to provide a shared directory on the Linux side, which can be accessed by the windows side. For security, only administrator users have read and write permissions, and ordinary users can only read.

First of all, Linux side:

1. Install samba

# yum install samba-y

# rpm-qa | grep samba

Samba-common-3.5.6-86.el6.x86_64

Samba-client-3.5.6-86.el6.x86_64

Samba-winbind-clients-3.5.6-86.el6.x86_64

Samba-3.5.6-86.el6.x86_64

two。 Add samba user

# useradd-d / data/share smb / / this user is an administrator user with read and write permissions, and / data/share is a shared directory

# smbpasswd-a smb

# useradd smbshare / / this user is for new employees. Read-only can only be downloaded, but cannot be uploaded or modified.

# smbpasswd-a smbshare

3. Start samba

# service smb restart

4. Allow samba to share its own root directory

# setsebool-P samba_enable_home_dirs 1

# getsebool-a | grep samba

Samba_enable_home_dirs-- > on / / this item becomes on

5. Edit configuration file

# vi/etc/samba/smb.conf

1) configure under Global Setting:

Security = share

Workgroup = Workgroup

Display charset = UTF-8

Unix charset = UTF-8

2) configure at the end of the file

[share]

Comment = network share

Path = / data/share

Public = yes

Writable = yes

Printable = no

Browseable = yes / / Hidden folder, which is equivalent to $under windows. Yes is shown and no hides.

Valid users = smb,smbshare / / valid user

Write list = @ smb / / only users who belong to the smb group have write permission

Create mask = 755

Directory mask = 755

Guest ok = no / / Anonymous access is off

6. Restart the smb service

# service smb restart

7.windows access, if prompted to have no access, contact the administrator. Then turn off selinux on linux

Command: # setenforce 0

Temporarily stop SELinux.

1) enter your server IP+ share file name

2) in order to prevent ordinary users from modifying the contents of the shared folder or uploading it wantonly, two users are set up.

Smb users are for administrators and can upload and download, while smbshare is for ordinary users only and can only be downloaded.

3) use smbshare user testing

Failed to create file in shared directory

In this way, the security of the shared directory can be guaranteed.

After reading the above, have you mastered how to configure samba in linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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