Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does linux share folders

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the knowledge of "how to share folders with linux". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. First of all, both servers need to install nfs and rpcbind services.

Check whether to install the service rpm-qa | grep nfs and rpm-qa | grep rpcbind

Install Service yum install nfs

Start the service systemctl start nfs.services (centos 8)

Services nfs start (centos 7)

View service status services nfs status (centos 7)

Systemctl status nfs.service (centos 8)

2. Modify / ect/exports file on 57

/ mnt/eauto100-statics 172.17.29.21 (rw,no_root_squash)

Description:

/ mnt/eauto100-statics is the shared path

172.17.29.21 client ip

Optional values for parentheses

Rw/ro:rw means (read-write) read-write, ro means (read-only) read-only

Sync/asyncsync means that data is synchronously written to memory and hard disk, while async means that data is temporarily stored in memory rather than written directly to the hard disk.

For the problem of no_root_squash/root_squash client access, you need to open no_root_squash. If you do not open the client, you cannot write.

Regardless of the identity of the user who logs in to NFS, all_squash 's identity is compressed to an anonymous user, usually nobody (nfsnobody).

Anonuid/anongid this UID must be stored in / etc/passwd

3. Open port 172.17.3.99

Modify / etc/sysconfig/nfs file

MOUNTD_PORT= "4002"

STATD_PORT= "4003"

LOCKD_TCPPORT= "4004"

LOCKD_UDPPORT= "4004"

4. View the nfs port on 172.17.3.99

Start the rpcbind service first, and then start the nfs service (be sure to pay attention to the startup sequence)

Use the command rpcinfo-p 172.17.3.99 to view the port on which rpc is listening

All these ports should be open on the firewall.

Edit / etc/sysconfig/iptables file join (centos 7)

-An INPUT-s 172.17.29.21 + 32-p udp-m udp-- dport 4004-j ACCEPT

-An INPUT-s 172.17.29.21 + 32-p tcp-m tcp-- dport 4004-j ACCEPT

-An INPUT-s 172.17.29.21 + 32-p udp-m udp-- dport 2049-j ACCEPT

-An INPUT-s 172.17.29.21 + 32-p tcp-m tcp-- dport 2049-j ACCEPT

-An INPUT-s 172.17.29.21 + 32-p tcp-m tcp-- dport 4003-j ACCEPT

-An INPUT-s 172.17.29.21 + 32-p udp-m udp-- dport 4002-j ACCEPT

-An INPUT-s 172.17.29.21 + 32-p tcp-m tcp-- dport 4002-j ACCEPT

-An INPUT-s 172.17.29.21 + 32-p udp-m udp-- dport 875-j ACCEPT

-An INPUT-s 172.17.29.21 + 32-p tcp-m tcp-- dport 875-j ACCEPT

-An INPUT-s 172.17.29.21 + 32-p udp-m udp-- dport 111j ACCEPT

-An INPUT-s 172.17.29.21 + 32-p tcp-m tcp-- dport 111j ACCEPT

Save and restart the firewall

5. Check the client 172.17.29.21 to see if it can be hung in the

Run the command showmount-e 172.17.3.99

If there is an error Port mapper failure-Unable to receive: errno 113 (No route to host)

It means there are still ports that need to be opened.

Return to the command netstat-tulnp on server 172.17.3.99 | grep-E'(rpc | nfs)'to view rpc and nfs ports

Continue loading the port into the firewall

6. Mount the shared directory

Run at 172.17.29.21

Mount-t nfs 172.17.3.99:/mnt/eauto100-statics / mnt/eauto100-statics

If you uninstall the mount point umount / mnt/eauto100-statics

7. Add self-start at 172.17.29.21

Edit / ect/fstab file

172.17.3.99:/mnt/eauto100-statics / mnt/eauto100-statics nfs rw,tcp,intr 0 1

This is the end of "how to share folders with linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report