Linux and Windows share the simplest Samba

Source: Internet
Author: User
Tags pkill
Article Title: Linux and Windows share the simplest Samba. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

0. Prerequisites for setting up a Samba server;

Linux is a multi-user operating system. Setting up any server is related to users, user groups, and permissions. This is the basis for operations. The Samba server is no exception. It is also very important to master this knowledge. Although the shared file server can also be mounted on Windows systems, its permission control is not flattering. If we use Windows to frame a network shared file system, we can also be confused by clicking the mouse. But in Linux, we can easily change the configuration file and build our Samba server in less than a few minutes. Which is easier? Only you know;

For the setup of Samba server, some brothers simply think that they only need to change the configuration file and create the corresponding directory. In fact, this is not the case. We need to do more in-depth work, such as directory permissions and ownership, that is, to allow users and user groups to have read and write permissions. Only by combining the configuration file with the permission of the shared directory can the Samba server be ready;

The following are common basic knowledge. We can find corresponding explanations in the list below for all the content involved in this article;

0.1 tools for viewing the file content and editing the file;

Introduction to Linux File Content viewing tools

File editor vi

0.2 related to files and directories;

Linux File Types and file extensions

Linux file and directory management: listing, deleting, copying, moving, and renaming

Linux file and directory attributes

Brief Introduction to Linux File Search

03 users and user groups;

Linux user and user group management overview

User and Group configuration file details

Introduction to Linux User management tools

Linux User query

04 process management;

Linux Process Management

1 Samba Introduction

Samba (SMB) is a network server used for sharing files between Linux and Windows. Samba can be used for sharing files between Windows and Linux, it is also used for file sharing between Linux and Linux. However, for file sharing between Linux and Linux, the Network File System NFS is better, and NFS also needs to set up servers;

We all know that each machine in the Windows network can be a file sharing server or a client, and Samba can do the same, for example, a Linux machine, if the Samba Server is mounted, 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.

The netbios protocol used by Samba. If you fail to use Samba,

Linux and Windows, Linux, and Linux

2 Samba functions and application scope

Samba should be mainly used in networks where Windows and Linux systems coexist. If a network environment is a Linux or Unix system, it is better to use NFS if Samba is not necessary;

So what services does Samba provide for us? Sharing Files and printers;

3 Samba two server-related startup programs, client and server configuration files;

3.1 Samba has two servers: smb and nmb;

Smb is the main startup server of Samba, allowing other machines to know what the machine shares. If the nmb server is not enabled, it can only be accessed through IP addresses, for example, enter the following entry in Windows IE browser for access;

\ 192.168.1.5 \ shared directory

\ 192.168.1.5 \ opt

Nmb is used for parsing. What does it resolve? Resolve the Working Group shared by this Linux machine and the netbios name under this Working Group;

In general, in the RPM package system, if Samba is installed in the RPM package, you can generally start the Samba server in the following ways;

[Root @ localhost ~] #/Etc/init. d/smb start

Start the SMB service: [OK]

Start NMB service: [OK]

What if it stops? Add stop after smb; restart is restart

[Root @ localhost ~] #/Etc/init. d/smb stop

[Root @ localhost ~] #/Etc/init. d/smb restart

For all systems, the common method is to run smb and nmb directly. Of course, you need to know the directory where smb and nmb are located. If Samba is compiled by yourself, you should know where you put Samba;

[Root @ localhost ~] #/Usr/sbin/smbd

[Root @ localhost ~] #/Usr/sbin/nmbd

Run the following command to check whether the server is running;

[Root @ localhost ~] # Pgrep smbd

[Root @ localhost ~] # Pgrep nmbd

To disable the Samba server, you can also use the following methods, which are mostly common. You need the root permission to execute them;

[Root @ localhost ~] # Pkill smbd

[Root @ localhost ~] # Pkill nmbd

3.2 view the port and firewall of the Samba server;

How can this be used? Sometimes your firewall may block the port of the smbd server, so we should use the port occupied by the smbd server. In the following view, we know that the ports occupied by smbd are 139 and 445;

[Root @ localhost ~] # Netstat-tlnp | grep smb

Tcp 0 0 0.0.0.0: 139 0.0.0.0: * LISTEN 10639/smbd

Tcp 0 0 0.0.0.0: 445 0.0.0.0: * LISTEN 10639/smbd

If you have a firewall, you must open these two ports. If you do not know how to open it. Maybe you are a newbie like me, or clear firewall rules;

[Root @ localhost ~] # Iptables-F

Or

[Root @ localhost ~] #/Sbin/iptables-F

3.3 view the configuration file of the Samba server;

If we use the Samba software package that comes with the Linux release, the configuration files of the Samba server are generally located in the/etc/samba directory, and the main configuration file of the server is smb. conf; there are also user configuration files such as smbpasswd, smbusers, and lmhosts (you 'd better check the content of these files); and there is a file such as secrets. tdb, this file is automatically generated by the Samba server startup. Let's add the description of these files according to the progress of the tutorial. All at once, I feel that there is too much content; therefore, only 1.1 points are allowed;

 

[1] [2] [3] Next page

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.