Build Samba using centos

Source: Internet
Author: User
Tags ftp client pkill
Samba is mainly used to share files or devices between Windows and Linux systems. It is a software package for sharing files and printing services between computers on the network. The protocol is the client service protocol, provided by a client similar to FTP Program The smbclient command of the client Samba program is generally used in the internal network.

Samba Overview

Introduction

Samba (SMB is SErver Message BlockIs a network server used for sharing files between Linux and Windows. samba can be used to share files between Windows and Linux. It is also used to share files between Linux and Linux. However, it provides a better network file system NFS for file sharing between Linux and Linux, NFS also requires server setup. we all know that each machine in the Windows network can be a file sharing server. samba works the same way. For example, if a Linux machine is installed with the Samba server, it can act as a shared server and can also be used as a client to Access Windows shared file systems in other networks, or other Linux sabmba servers. in Windows network, we can see the shared file function, we can directly use the shared folder as a local hard disk. in Linux, Samba is used to provide a shared file system to machines on the network. It can also be used to mount the sharing of other machines on the local machine. in a sense, this is different from ftp. Samba uses the NetBIOS protocol.

 

+ Personal understanding
    1. Samba should be mainly used to share files or devices between Windows and Linux systems;
    2. Samba is a software package for sharing files and printing services between computers on the network;
    3. The Samba protocol is a client service protocol;
    4. Samba provides a smbclient command for samba client programs similar to FTP client programs;
    5. Samba is generally used in the internal network;
       
Daemon

Samba has two Daemon Processes: smbd and nmbd.

    1. Smbd listens to port 139 TCP* Nmbd cannot be started if this process is not enabled, and smbd cannot start smbad.
    2. Nmbd listening 137 and 138 UDP fracture* Nmbd is used only when smbd is not started.

       

Build Environment

Samba is installed on centos 5.5 by default,

However, my system is 5.6. By default, Samba is not installed, and the source code is installed.

Samba home: http://www.samba.org

#Installation environment

 
Yum-y install samba

 #  Change configuration file  
VI / Etc / Samba / SMB . Conf

# Configuration section
[ Global ] # Set Global Environment options

Workgroup # Develop a working group or domain
Server String # Description
Security # System Security Mode

# Security Options
1 . Share # No verification required (not used)
2 . User # The default setting is recommended. It is verified by * UNX Samba server.

3 . Server # Third-party host Verification
4 . Domain # Third-party host verification (must be a Windows Domain Controller)

# Basic limits of services:
# Host access
# Two options are available by default.
1 . Hosts allow # Write only this host can access, can write network segment, can write IP address, can write Domain Name
2 . Hosts deny # Define a client that is not allowed to access

LOG _ File # Log directory
Max Log Size # The maximum log size is 50 kb.

[Homes] # Set user home directory sharing
Comment # Description
Browseable # Yes or no
Writable # Writable or not: No read-only yes writable
Valid users # % S matches every user
Valid user # Specified domain name

[Printers] Set printer sharing
[Program files] set file sharing
Service startup Item
    1. /Etc/init. d/SMB start Enabled
    2. /Etc/init. d/SMB stop
    3. /Etc/init. d/SMB restart
    4. Pkill SMB; pkill nmbd kill samba
    5. Pgrep SMB; pgrep nmbd check whether daemon is enabled
       

Smbclient command

 Command description

? Or help [command] provides help for help or a command
! [Shell Command] Run the shell command used, or let the user enter the shell prompt
Switch the CD [Directory] to the specified directory on the server. If not, smbclient returns the current local directory.
Switch the LCD [Directory] to the specified directory on the client;
Dir Or ls to list the files in the current directory;
Exit Or quit to exit smbclient.
Get file1 file2 downloads file1 from the server and stores it on the local machine with the file name file2. If you do not want to change the name, you can omit file2.
Mget file1 file2 file3 filen downloads multiple files from the server;
The MD or mkdir directory is used to create a directory on the server.
Rd or rmdir directory Delete the directory on the server
Put file1 [file2] upload a file file1 to the server , Uploaded to the server and renamed it file2;
Mput file1 file2 filen upload multiple files to the server

Check whether the service is successfully started.

OK. click Next.

Disable the security module and firewall.
1. setsebool-P samba-enable_home_dirs on
2. VI/etc/SELinux/configselinux = disabled
3. iptables-fsamba is mainly used to share files or devices between Windows and Linux systems. It is a software package for sharing files and printing services between computers on the network. The protocol is the client service protocol, the smbclient Command provided by samba client, similar to the FTP client program, is generally used in the internal network.

Samba Overview

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