A simple example of file sharing between multiple platforms in Linux (RedHat) __linux

Source: Internet
Author: User

1,linux in the details of samba installationTo achieve resource sharing between Windows hosts and Linux servers, the Linux operating system provides samba services, and Samba services bridge two different operating systems to enable communication between Linux systems and Windows systems. Provides great convenience for a wide range of Linux enthusiasts. This article briefly describes how to build a Samba server and a simple configuration on a Linux operating system.
1, Service inquiries
By default, the Linux system already has a portion of the Samba Service pack installed in the default installation, and to have a complete understanding of the process, uninstall this part first. Using commands
Rpm-qa | grep Samba, which can be queried by default to two existing packages:
Samba-client-3.0.33-3.7.el5
Samba-common-3.0.33-3.7.el5
2. Uninstall Samba
Use RPM-E to unload two packets. For Samba-common-3.0.33-3.7.el5, because there is a dependency on the other RPM packages, you must add the arguments-F and--nodeps,-f are mandatory,--nodeps means do not check dependencies, the complete command is:
RPM-E samba-common-3.0.33-3.7.el5-f--nodeps
RPM-E samba-client-3.0.33-3.7.el5-f--nodeps

3. Install Samba
Install with the following command:
RPM-IVH samba-3.0.33-3.29.el5_6.2.i386.rpm-f--nodeps
RPM-IVH samba-client-3.0.33-3.29.el5_6.2.i386.rpm-f--nodeps
RPM-IVH samba-common-3.0.33-3.29.el5_6.2.i386.rpm-f--nodeps
After the installation is complete, use the command Rpm-qa | grep Samba queries to find that all the servers on which the Samba server is built are already installed.
4. Configure smb.conf Files
Samba's configuration file is generally placed in the/etc/samba directory, The main configuration file, named Smb.conf, with a large number of rules and shared information in the file, is the core profile of the Samba service, which is where most of the major configurations for the Samba server are built.
The Samba server works by initiating a request to the Samba server, requesting access to the shared directory, and the Samba server receiving the request, Query the smb.conf file, see if the shared directory exists, and the visitor's access rights, if the visitor has the appropriate permissions, then allow the client to access, and finally the system in the process of access information and the acquisition of user access behavior information stored in the log file.
First step: Modify the configuration file
First back up Samba's configuration file
Cd/etc/samba
MV Smb.conf Smb.confbak
Then recreate a smb.conf file
Touch smb.conf
And then we'll write this in smb.conf.
[Global]
Workgroup = Linuxsir
NetBIOS name = LinuxSir05
Server string = Linux Samba server TestServer
Guest OK = yes
Security = SHARE
[Linuxsir]
Path =/opt/sambadir
writeable = yes
browseable = yes
Guest OK = yes

Annotations:
This segment of [global] is a global configuration and is required for the segment to be written. These are the following lines;
Workgroup is the workgroup that is displayed in Windows; Here I set the Linuxsir (in uppercase);
NetBIOS name is the computer name that is displayed in Windows;
The server string is the Samba server description that you can define yourself; this is not important;
Security This is the authentication and login method, here we use the share; there are many kinds of authentication methods, this is one of them; another commonly used is the user authentication method; If you use share, you don't have to set up users and passwords;
[Linuxsir] This display in Windows is a shared directory;
Path = You can set where the directory you want to share is placed;
Whether the writeable can be written, here I set to writable;
Browseable Whether you can browse, or you can browse means that we can see the shared folder under the workgroup. If you don't want to show it, set it to Browseable=no.
Guest OK anonymous user is logged in as guest;
The second step: establish the corresponding catalogue and authorize;
[Root@localhost ~]# mkdir-p/opt/sambadir
[Root@localhost ~]# ID Nobody
Uid=99 (nobody) gid=99 (nobody) groups=99 (nobody)
[Root@localhost ~]# chown-r Nobody:nobody/opt/sambadir
Comments:
Regarding the authorization nobody, we first viewed the nobody user's information with the ID command, discovered that his user group is also nobody, we must take this as the standard. Some systems nobody user groups are not nobody;
Step three: Start SMBD and NMBD server;
[root@localhost ~]# service SMB start
[root@localhost ~]# service SMB stop
[root@localhost ~]# Service SMB restart
In Redhat, you can use the Samba service to start at boot time.
Chkconfig--level 345 SMB on

Installing NFS file servers in 2,linux


In the server-side/etc/exports file, configure the following:
/opt/nfsdir 172.16.245.0/24 (Rw,insecure,sync,no_subtree_check,no_root_squash)
Start and stop NFS services
[Root@localhost ~]# Service NFS Start
[Root@localhost ~]# Service NFS Stop
[Root@localhost ~]# Service NFS Restart
You can use an NFS service to start at boot time in Redhat.
Chkconfig--level 345 NFS on
Mount the NFS file system on another Linux machine
[Root@localhost root]# mount-t NFS 172.16.245.103:/opt/nfsdir/mnt/nfs/
umount/mnt/nfs/

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.