Configure Samba and NFS services in linux

Source: Internet
Author: User


In linux, Samba service and NFS service configuration 1. Samba service configuration process is simple to achieve sharing between linux and windows. Using samba to build a file server is not only more powerful than windows, but also fast and secure access. The samba server requires two Daemon Processes: smbd and nmbd. The smbd process listens to the 139TCP port and processes incoming SMB packets. The nmbd process listens to ports 137 and 138UDP so that other hosts can browse the linux server. 1. install the Samba service www.2cto.com. First, run the command to test rpm-qi samba to check whether the Samba software package is installed. If not, use yum install samba for online installation (in the fedora 11 environment ). 2. After the Samba service is installed, run the service smb start command to start the samba service. To enable automatic loading of the samba service at startup, use the ntsysv command (or the system service option in the setup command) to enable the service automatically loaded at startup, and check smb, after confirming, you can load the samba service at startup. 3. Disable the firewall. By default, the firewall closes the 139 TCP port and the 137 and 138 ports required by the nmbd process. Therefore, we use the Command service iptables stop to disable the firewall. You can also modify the firewall to allow the TCP139 UDP 137 and 138 ports. Www.2cto.com 4. Configure the samba service configuration file/etc/samba/smb. conf, use the VI editor to open vi/etc/samba/smb. conf file to configure smb for samba. the conf file contains 4 structures, including [Global], [Homes], [printers], and [Userdefined_shareName], where: globa is used to define global parameters and the default value. Homes is used to define the user's home directory sharing Printers. The printer sharing Userdefined_ShareName is used to customize sharing (multiple can be used) Description: the "#" header in the file is the description file and is not executed. The example file starts with ";" and is not executed (if you want it to be executed, remove ";"). Www.2cto.com configure the Global parameter [Global] ◎ basic Global parameter workgroup = MYGROUP set the Working Group server to which samba is to be added string = Samba Service specify the machine description in the browser list netbios name = fedora set samba NetBIOS name (you need to add it yourself) client code page = 936 set the client character encoding 936 to simplified Chinese (you need to add it yourself) ◎ log global parameter log file specify the name of the log file max log size = 50 specify the maximum size of the log file (KB) ◎ security global parameter www.2cto.com security defines the samba installation level, share-users can log on to the samba server without the user name and password. user-the samba server that provides the samba Service is responsible for checking the account and password; server -- check the account and password to specify DowsNT/2000 or samba server; domain -- specify the windowsNT/2000 domain Controller to verify the user account and password encrypt passwords = yes smb passwd file =/etc/samba/smbpasswd to set whether to encrypt the samba password, and specify the storage path of the encrypted file. ◎ to configure custom sharing and custom sharing, you only need to add share at the end of the file. One of the parameters is described by comment. The name of the shared file is www.2cto.com. The path defines the shared directory. browseable: Specifies whether the shared directory can be browsed. writable: Specifies whether the shared directory has the write permission. read only specify the shared directory as public with read-only permission and specify whether the same public permission can be used by the Guest account to ACCESS guest OK, yes indicates that only the guest user can access calid users. For example: comment = my share path =/home/share browseable = yes read only = yes public = yes only guest = yes ◎ work after configuration is complete www.2cto.com after configuration is complete, we only need to create the shared directory mkdir/home/share defined by path, and Use the chmod command to set the permission to 777, chmod 777/home/share. In this way, after the service smb restart restarts the smb service, the client can access the server (I modified security = share in the global parameter, so the user name and password are not required to enter the server ). Run: // 192.168.1.6 (linux IP address) in windows. Ii. NFS service configuration process 1. Check whether two software packages NFS-utils and portmap are installed in the linux system. # rpm-q nfs-utils (portmap) www.2cto.com 2. Check whether the NFS server is started # service nfs status # service portmap status if the server is not started, enable the service (nfs is not fully enabled by default) # service nfs start # service portmap start can also be disabled under the ntsysv command and enable nfs for Automatic startup. 3. Specify the NFS server configuration file. the NFS server configuration file is saved in the "/etc/" directory. The file name is "exports ", the file is used to share the directory provided by the NFS server with www.2cto.com # vi/etc/exports. The format of the "exports" file is as follows:/tftpboot * (sync, ro) tftp: the shared directory name * indicates that the "configuration options" field in the exports file of all hosts (sync, ro) setting options is placed in the brackets, separate multiple options with commas (,): Set the NFS server to write data to the disk synchronously, so that data will not be lost easily. We recommend that you use this option for all NFS shared directories. ro: set the output shared directory to read-only. rw cannot be used together with rw: Set the output shared directory to read/write, cannot be used together with ro 4. Re-output the shared directory www.2cto.com Exportfs management tool to manage the "exports" file # exportfs-rv allows new Display the output list of the NFS server on the current host # showmount-e display the shared directory that has been mounted by the NFS client on the current host # showmount-d 5. Run the mount command to mount the NFS file system # mount 192.168.1.6: /tftpboot/home/share mount the/tftpboot directory in the Host IP address 192.168.1.6 to the/home/share unmount mounted NFS shared directory # the NFS shared directory cannot be detached when umount/home/share is unmounted. unmount in the/home/share directory, you must log out of the system and uninstall it. Www.2cto.com PS: If the portmap Process stops running or ends abnormally, all RPC servers on the system must be restarted. Stop all NFS service processes on the NFS server, start the portmap Process, and then start the NFS process on the server. However, portmap only works when a connection is established for the first time to help network applications find the correct communication port. However, once the two sides connect correctly, the port is bound to the application and portmap does not work. But it is still useful for any other application that needs to find the port for communication for the first time. Simply put, portmap is the marriage introducer of the application and port. After the two parties get involved, the matchmaker will be useless.

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.