How to build a file server in Linux

Source: Internet
Author: User
Tags anonymous file system ftp ftp file valid ftp file transfer port number

Building a Samba file-sharing server

1.) Samba Services

protocol used by Samba communications

Smb:server messages block, service message blocks

Cifs:common Internet File system, universal Internet filesystem


Samba-common Public Package

Samba Server Main program

Samba-client Client Tools

System-config-samba provides graphical interface management program

Samba-swatweb Mode management Tools

The Samba server mainly provides the following two service programs

SMBD: Provide the client with shared resources in the server

NMBD: Provides resolution based on NetBIOS host names

Samba Service configuration file

/ETC/SAMBA/SMB.CONF Master configuration file

/etc/samba/lmhosts NetBIOS Resolution File

/ETC/SAMBA/SMBPASSWD access to the Samba service account file

/etc/samba/smbusers Samba account and Windows account mapping relationship

SMB.CONF Master configuration file

This article URL address:

[Global] Global setting: Valid for the entire Samba server

[Homes] User directory share settings: A default share for the Samba user host directory, a shared file with the same name in the user's access server, and a default mapping of its own host directory

[Printers] Printer sharing settings: Need to share printers,

Common configuration and implications of smb.conf files

Workgroup: Workgroup name

Server sting: Servers description information

Security: Safety level: Share, user, domain, server Doman

Log file: Server logs

Max log size: Maximum log size

Comment: Comments, descriptive information for the shared directory

Path: Folder path corresponding to shared directory in server

Browseable: Shared directories can be seen on the Internet neighborhood

Guest OK: Everyone can access the shared directory

Writable: Whether a shared directory can be written

Samba Server provides profile checking tool: Testparm Program

2.) Establish file sharing with validation

Share name sharing settings

Comment = shared folder description information Path = shared folder absolute path

public = yes/no Guest OK = yes/no

writable = yes/no Read Only = yes/no

browseable = yes/no Valid users = List of users

Invalid users = user List Write list = user list

Read list = user list Create mask = Mask

Directory mask = Mask

Building a Samba user database

The Samba account must be a system account and the password can be different from the system account

SMBPASSWD [-a/d/e/x] account name

-H: Displays help for the SMBPASSWD command

-A: Add the specified Samba user account

-D: Prohibit specified account

-e: Start the specified account

-X: Delete the specified account

Modify the Samba user password without parameters

User mapping file is located in "/etc/samba/smbusers"

Add User authorization Settings

The user authorization settings for the shared directory are mainly "Valid users, write list" configuration Items set to cancel the public access setting "Public=no"

Multiple users need to be authorized to be separated by a space or comma, and the authorized user group will be "@ Group name"

Set the default permissions for the subdirectories and files established by the Samba user in the shared directory, using the configuration item "directory Mask, create mask"

Add Client Address authorization settings

In the smb.conf file, use the hosts allow configuration key settings to allow access to the shared client address

Use the hosts deny configuration key to set the access denied client address

Start Services service SMB start

3.) Access to file sharing services using Linux clients

Use the Smbclient tool to log on to the Samba server

Smbclient [-l]//server IP [-u user Name]

Use the Mount command to hang a shared directory locally (cannot be mounted if the server does not have write access to the shared user)

Mount [t-CIFS]//server ip/share name/mount directory [-o username= Username]

Building FTP File Transfer Server

1. ) Overview of the FTP service

Connection and Transfer mode

Active mode: Server (20) to build data connection with client (>1024) actively

Passive mode: Client (>1024) data connection with server (>1024)

Establish whether the connection is a character conversion

Text mode: Use ASCII characters when transferring files, suitable for plain text

Binary mode: Do not convert characters in a file, suitable for programs, pictures, and other files

FTP User type: Anonymous (ftp,anonymous), local user, virtual user (access to FTP service only)

Types of FTP Server packages





2.) VSFTPD Service Base

Configuration file

/ETC/VSFTPD/VSFTPD.CONF Master configuration file

/etc/vsftpd/ftpusers blacklist, the user in this file cannot access the FTP server

/etc/vsftpd/user_list master configuration has userlist_enable=yes, Userlist_deny=yes deny users in this file access to the FTP server, the main configuration file has Userlist_enable=yes, Userlist_deny=no only allows users in this file to access the FTP server main configuration key configuration entry

Global configuration

Download_enable=yes/no whether the client is allowed to download

pasv_max_port= port number upper limit used in passive mode

Lower port number used by pasv_min_port= port number Passive mode

max_clients= How many clients are allowed to connect simultaneously in the number of clients

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: 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.