In the embedded system development application platform, tftp, nfs and samba servers are the most commonly used file transfer tools. Tftp and nfs are frequently used transfer tools in the embedded Linux development environment, and samba is a file transfer tool between Linux and Windows. Samba is a communication protocol that imitates the SMB of Windows Network Neighborhood, which "pretends" the Linux operating system to be a Windows operating system and transfers files through the Network Neighborhood. Virtual machine version: VMware10 Linux operating system version: Red Hat Enterprise Linux 5 Introduction to Samba ServerSamba is a free software that implements the SMB (Session Message Block) protocol on Linux systems to achieve file sharing and printer service sharing. Samba Server ComponentsSamba has two main processes: smbd and nmbd. The smbd process provides file and print services, while nmbd provides NetBIOS name services and browsing support, helps SMB clients locate servers, and handles all UDP-based protocols. Samba server related configuration files /etc/samba/smb.conf /etc/samba/lmhosts /etc/sysconfig/samba /etc/samba/smbusers /var/lib/samba/private/{passdb.tdb,secrets.tdb} /usr/share/doc/samba-<version> As for the commonly used script files, if divided into server and client functions, there are mainly the following data:
Install SambaFirst, confirm whether Samba is installed on your Linux using the command: [root@localhost ~]# rpm -qa | grep samba Among them: samba, samba-common, and samba-client are required. If it is not installed, there are two ways to install it: The first method: yum installationYum is a Linux software package that is used to find, install, update, and remove programs. It runs on RPM package compatible Linux distributions, such as: RedHat, Fedora, SUSE, CentOS, Mandriva. yum install -y samba The second method: installation package installationThe installation packages are all on the CD, first you need to mount it: [root@localhost ~]# mount /dev/cdrom /mnt At this time, a problem will arise:
The prompt message says that when the CD-ROM drive is mounted to the virtual machine, it prompts read-only. The following command can resolve this error:
At this point, we will find that the originally empty folder /mnt now has many more files. In the /mnt/Server folder, you will find the Samba installation package: After finding the installation package, it is time to install Samba (you only need to install the one you don't have). Use command: rpm samba-3.0.25b-0.el5.4.i386.rpm rpm samba-client-3.0.25b-0.el5.4.i386.rpm rpm samba-commons-3.0.25b-0.el5.4.i386.rpm After the installation is complete, use the command to verify whether the installation is complete: [root@localhost ~]# rpm -qa | grep samba Configure SambaModify the configuration fileThere is actually only one main configuration file for the samba server, which is /etc/samba/samba.conf. This configuration file can be divided into two parts, one part is global parameters, and the other part is shared resource related parameters. #1. Global parameter settings: [global] #Settings related to the host nameworkgroup = zkhouse <==Workgroup namenetbios name = zkserver <==Host name, which is not the same as hostname. In the same group, the netbios name must be uniqueserverstring = this is a test samba server <==Descriptive text, the content is irrelevant#Settings related to the login filelog file = /var/log/samba/log.%m <==The storage file name of the log file, %m represents the client Internet host name, that is, hostname max log size = 50 <==The maximum size of the log file is 50Kb #Password-related settings security = share <== means no password is required. The configurable values are share, user, and server passdb backend = tdbsam #Printer loading mode load printer = no <==Do not load the printer----------------------------------------------------------- #2. Shared resource settings: comment out the old ones and add new ones #First cancel the [homes] and [printers] items, and add the [temp] item as follows [temp] <==shared resource name comment = Temporary file space <==simple explanation, the content is irrelevant path = /tmp <==actual shared directory writable = yes <==set to be writable browseable = yes <==the resource name can be browsed by all users, guest ok = yes <== allows users to log in at will In other words, just add the above "#2 Shared resource settings" to the end of the configuration file. Add a user and set a passwordSet up an account to log in to the samba server and set a password. Specific commands: [root@localhost ~]# useradd sambauser [root@localhost ~]# smbpasswd -a sambauser New SMB password: Retype new SMB password: Restart Samba Server[root@localhost ~]# /etc/init.d/smb restart If this command does not work, then Samba was not installed correctly. Login to SambaWhen both Windows and Linux networks are connected, log in to the Samba server in Windows. Use the command to view Samba's IP address: [root@localhost ~]# ifconfig In Windows, enter \\223.3.119.170 (the IP address corresponding to Samba): At this time, the login interface will pop up. Just enter the login account and password you set previously. Summary of questions and supplementsPreviously, Samba was installed and configured step by step without any problems. But in many cases, when Windows is running, after entering the \\IP address, nothing happens. This is the most troublesome part because we have no idea what caused it. Here are a few possible problem areas: Network SelectionWhen configuring the Samba server, the network is selected as a bridge connection. This is because: it is necessary to ensure that the IP under Linux and the IP under Windows are in the same network segment and can ping each other. How to verify? In the Windows command line, enter the command ipconfig: At the same time, enter the command ifconfig in Linux (the two commands are different, please note): It can be seen that the first three characters of the two IP addresses 223.3.119.239 and 223.3.119.170 are the same, and only the last one is different, which ensures that they are in the same network segment. If the first 3 digits are different, you can use the command in Linux: [root@localhost ~]# ifconfig eth0 223.3.119.130 Just make sure that only the last one is different. Next, verify that the ping between Windows and Linux is successful. Enter the ping Linux IP address in the Windows command line : If the result is not a timeout, it means that the two can ping each other successfully. Firewall issuesIf the firewall is not disabled, communication between Windows and Samba may be blocked. Turn off the firewall on Windows: Control Panel -> System and Security -> Windows Firewall -> Turn Windows Firewall on or off; Disable the firewall on Linux: [root@localhost ~]# setenforce 0 [root@localhost ~]# service iptables stop Remember to restart the Samba server. Permission issuesThere may be a problem of insufficient permissions. Modify the permissions of the file you want. [root@localhost ~]# chmod 777 /home No accessIf you use Windows to access Samba, the following dialog box error pops up: Unable to access. You might not have permission to use the network resource. Please contact the administrator of this server to find out if you have access permissions. Multiple connections to a server or shared resource by a single user using more than one user name are not permitted. Disconnect all connections to this server or shared resource and try again... or simply restart Windows. How do I disconnect (i.e. exit the Samba server)? In the Windows command line, enter: net use * /delete /y Automatic connectionTo automatically run the smba server every time you start Linux: In the terminal, enter setup->system service->find smb, press the space bar, then select it->exit to complete (note that the tab key is used to switch). If you have any other questions, you can also refer to the link: [Linux] Installation and configuration of samba server, 159 samba cannot be accessed. You may not have permission to use the network resource net use command. This is the end of this article about the super detailed installation and configuration of Linux Samba server (with problem solving). For more relevant Linux Samba server installation and configuration content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Website Building Tutorial for Beginners: Learn to Build a Website in Ten Days
>>: Introduction to install method in Vue
Preface In JavaScript, you need to use document.q...
Red and pink, and their hexadecimal codes. #99003...
Click here to return to the 123WORDPRESS.COM HTML ...
You can use the ps command. It can display releva...
One port changes In version 3.2.0, the namenode p...
Table of contents Summarize Summarize When the ar...
need: In background management, there are often d...
This article shares the specific code of JavaScri...
How to set up a MySQL short link 1. Check the mys...
We all know that Apache can easily set rewrites f...
Table of contents 1. props/$emit Introduction Cod...
【question】 We have an HP server. When the SSD wri...
MySQL version: MySQL Community Edition (GPL) ----...
Preface Recently, I have been busy dealing with s...
This article shares a blinds special effect imple...