Samba for embedded environment construction

Source: Internet
Author: User
Samba for building an embedded environment this article mainly introduces the causes and consequences of samba, which has been a brief introduction to samba, and introduces how to install samba in ubuntu, samba server configuration and how to share the samba server in window7. At last, we summarize the application scenarios of samba. I ,... samba for building an embedded environment this article mainly introduces the causes and consequences of samba, which has been a brief introduction to samba, and introduces how to install samba in ubuntu, samba server configuration and how to share the samba server in window7. At last, we summarize the application scenarios of samba. I. Samba's past and present in the early online world, most of the files and data transmitted between different hosts are transmitted using FTP. However, there is a defect in using FTP to transfer documents and data, that is, the documents and data on the Server cannot be directly modified! That is, when you want to modify a file on the server, you must download the file from the server to the client before modification. then, you can upload the file to the server. From this process, we can see that the file exists on both the Server and Client. If you modify a document but forget to upload it back to the host, the document version on the client and server is incorrect. Therefore, the predecessors in the IT field proposed whether the documents above the Server can be directly accessed on the Client machine. if the files on the Server can be directly accessed on the Client, in this case, the archive data does not need to exist on the Client, that is, as long as the archive data on the Server exists! Is there such a File System? -------- NetworkFile System, NFS is one of these document systems! As long as the shared directory provided by the Server is mounted to the Client, you can directly access the file data on the Server on the Client machine, this data is like a partition on the Client side! In addition to the NFS server that allows Unix Like machines to share files with each other, there is a similar copywriting System on Microsoft, that is, CommonInternet File System and CIFS! CIFS is a common "network neighbor 』. Windows computers can share the file data provided by others through "network neighbors" on the desktop. However, NFS can only communicate with Unix machines, and CIFS can only communicate with Windows machines. Is there an archive system that allows Windows and Unix-Like platforms to share their archive data? 2. samba introduction Samba is created under the requirements mentioned above. Samba is a free software that implements the SMB protocol on Linux and UNIX systems. it consists of servers and client programs. It supports sharing documents and data between windows and Unix-Like platforms. 3. after samba is installed in Ubuntu12.04, the system will bring its own samba system. In the previous Ubuntu system, you can run the following command to install it. Sudo apt-get install samba-common 4. configure smb. the Samba configuration file of the conf file is generally stored in the/etc/samba Directory. The main configuration file name is smb. conf, which records a large amount of rules and shared information. Therefore, it is a very important core configuration file for the samba service. most of the main configurations for completing samba server setup are carried out in this file. The working principle of the Samba server is that the client initiates a request to the Samba server to access the shared directory. The Samba server receives the request and queries the smb. conf file to check whether the shared directory exists and the visitor's access permissions. if the visitor has the corresponding permissions, the client is allowed to access it, finally, the system information and user access behavior information collected during access are stored in the log file. 4.1 meanings of fields in the samba configuration file: (1) security = user description: sets the authentication method for users to access the Samba Server. There are four verification methods. 1> share: users do not need to provide user names and passwords to access the Samba Server, and the security performance is low. 2.> user: The Samba Server shared directory can only be accessed by authorized users. The Samba Server is responsible for checking the correctness of accounts and passwords. The account and password must be created in this Samba Server. 3.> server: relies on other Windows NT/2000 or Samba Server to verify the user's account and password. it is a proxy authentication. In this mode, the system administrator can centralize all Windows users and passwords on an NT system and use Windows NT for Samba authentication. the remote server can automatically authenticate all users and passwords, if authentication fails, Samba uses the user-level security mode as an alternative. (2) comment = any string description: the description text for shared resources. the default value is a null string. (3) path = shared directory path description: path is used to specify the path of the shared directory. You can use macros such as % u and % m to replace the Netbios names of unix users and clients in the path. They are mainly used for [homes] shared domains. For example, if we do not want to use the home segment as the customer's share, but create a directory for each Linux user under/home/share/as the shared directory with his/her username, in this way, the path can be written as: path =/home/share/% u ;. When a user connects to the shared object, the specific path will be replaced by the user name. Note that the path of the user name must exist. Otherwise, the client cannot find the network path during access. Similarly, if we do not divide directories by users, but by dividing directories by clients, we will create a path with its netbios name for each machine on the network that can access samba, as resources shared by different machines, you can write: path =/home/share/% m. (3) browseable = yes/no description: browseable is used to specify whether the share can be viewed. (4) writable = yes/no description: writable is used to specify whether the shared path is writable. (5) read only: used to set whether the shared resources are read-only. Read only = yes: Allow read-only = no; read/write (6) available = yes/no description: available is used to specify whether the shared resource is available. (7) admin users = Administrator of the share: admin users is used to specify the share administrator (with full control permissions on the share ). In samba 3.0, this item is invalid if the user authentication method is set to "security = share. For example, admin users = bobyuan and jane (multiple users are separated by commas ). (8) valid users = users allowed to access the shared resource description: valid users is used to specify users allowed to access the shared resource. For example, valid users = bobyuan, @ bob, @ tech (multiple users or groups are separated by commas (,). to join a group, use "@ + group name .) (9) invalid users = forbidden to access the shared user description: invalid users is used to specify users that are not allowed to access the shared resource. For example, invalid users = root, @ bob (multiple users or groups are separated by commas .) (10) write list = users who are allowed to write data to the shared object description: write list is used to specify users who can write files to the shared object. For example: write list = bobyuan, @ bob (11) public = yes/no description: public is used to specify whether the share allows access by the guest account. (12) guest OK = yes/no description: whether to allow users to access this resource without using their accounts and passwords. Guest OK = yes: allow users not to use the account and password to access this resource guest OK = no: do not allow users not to use the account and password to access this resource (13) host allow: set the host connection address: hosts allow = 192.168.0.server.abc.com: allow access from 192.168.0. or server.abc.com (13) host deny: Set the host address hosts deny = 192.168.2 to prohibit access to the samba server's resource 4.2 instance from host 192.168.2: if you want to share all files on the ubuntu host with windows users. You can use the following configurations. [hostname] path =/home/hostname valid users = hostname public = no writable = yes printable = no create mask = 0765 security = userNote: copy the configuration information above to/etc/samba/smb. at the end of the conf file, change the red part above to your host name. 4.3 set the samba password. this password is used when the windows host maps to the ubuntu host. this password can be different from the ubuntu login password. Command format: smbpasswd-a hostnameNote: hostname is your ubuntu host name. 4.4.restart after samba is set, restart the samba service. Run the command: service smbd restart in ubuntu to restart the samba service. 4. use Windows shared ubuntu1. open my computer, right-click the ING network drive, and enter the IP address and host name (\ server \ hostname) of the ubuntu host, for example \ 192.168.1.99 \ jibo. 2. click browse and enter the samba password you just set to perform network ING. OK, youcan enjoy it !!! Conclusion: (1) Why (Why samba appears) to share files between unix like machines and windows machines. (2) how (Samba use cases) 1> network sharing protocol between Windows and Linux, used for sharing between virtual machines and local machines, as well as remote servers and local machines 2> for the same shared file, different permissions can be set for different users. password protection can be set. 3. linux machines are treated as servers. multiple windows clients share data and files between linux machines through samba, suitable for team Development 4> Instant synchronization

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.