Build a Samba server on Linux for cross-platform file sharing with Windows

Source: Internet
Author: User

Samba is one of the well-known open source software projects that implements Microsoft's Smb/cifs network protocol in the Linux/unix system, making cross-platform file sharing easier. When deploying the enterprise environment of Windows, Linux/unix hybrid platform, samba can be used to solve the problem of exchanging files between different systems.


Today, let's try to build a Smaba service on Redhat, and use Win7 as a client to access the different features of samba services.


    • Deploy Samba Services (anonymous shared access, local user access, virtual user access):


) Install the package:

rpm-ivh/mnt/packages/samba-3.6.9-164.el6.x86_64.rpm


1) Anonymous shared access:


Edit the configuration text, add anonymous shared parameters

vim/etc/samba/smb.conf # #修改主配置文件
    security = share     # #修改为 "Share" anonymous sharing              # #在行尾添加下面的参数          [share]        path = /opt/abc      ## "Specify File path"         public = yes             //yes/no         browseable = yes      # #访问权限          writable = yes          # #写权限            create mask = 0644   # #文件权限         directory mask = 0755   # #目录权限


Create a directory and set permissions, turn off the firewall, turn on the service

Mkdir/opt/abcchmod 777/OPT/ABC
Service iptables Stopsetenforce 0
Service SMB Start


Turn off the firewall and try to access it with Win7


2) Local User access:


Edit the configuration text, add local user access parameters

vim/etc/samba/smb.conf # #修改主配置文件
Security = user # #设置参数为用户登录 # #在行尾添加下面的行 [WZN] path =/opt/wzn # #指定文件路径 browseable = ye S # #访问权限 Create mask = 0644 # #文件权限 Directory mask = 0755 # #目录权限 Valid users = wzn,wzn1 # # Specifies that the user can log on to access the Write list = Wzn # #指定用户可以写入


Set the local user's password

Smbpasswd-a XX (user name) # #仅对登录samba的用户进行设置密码pdbedit-L # #查看所有Samba用户


Restart the service and log in using the WZN user on the Win7 host.


3) Virtual user access:

Set the virtual mapping account "1", "2", "3" for local user Wzn, and log in to samba services with a mapped account

Vim/etc/samba/smbusers # #编辑虚拟映射用户文件
# #在行尾下添加新的行wzn = 1 2 3 #wzn用户的登录虚拟映射用户为 "1". " 2 "." 3 "


Edit the Samba configuration file and add the newly added profile to make it effective

Vim/etc/samba/smb.conf
# #找到下面的行 and insert a line under Security = user Passdb backend = Tdbsam username map =/etc/samba/smbusers # #添加此 Yes


At this time we are logged in, you can set the virtual mapping user directly login, password is the real user's password.

Build a Samba server on Linux for cross-platform file sharing with Windows

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.