4

Mac 作为NFS服务器

 6 months ago
source link: https://blog.dreamtobe.cn/mac_nfs_service/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

本文最后更新于:2023年9月2日 凌晨

我们都知道Mac是自带NFS服务的,但是默认是没有开启,并且配置文件/etc/exports也不存在,这篇文章就简单介绍了如何将Mac的NFS服务开起来,并且共享某一个目录给到局域网。

配置需要共享的目录

假设你需要共享的目录是/Volumes/BACKUP/dev/tools,并且对外可以访问的权限等于当前Mac的用户jacks,你的局域网是10.0.0.0,那么你可以通过sudo nvim /etc/exports添加如下设置将其假如为共享目录:

/Volumes/BACKUP/dev/tools -mapall=jacks -network 10.0.0.0 -mask 255.255.255.0
EXPORTS

检查配置状态:

sudo nfsd checkexports

正常无报错会没有任何输出。如果报如下没有权限的错误:

需要到系统安全设置中针对完全磁盘访问权限点击+,然后按cmd+shift+G,输入/sbin/nfsd,将nfsd权限添加上即可。

mac_nfs_service_8f76e6ba_1.png

然后重启服务:

sudo nfsd restart

此时可以查看挂载状态:

showmount -e

mac_nfs_service_151900c1_2.png

至此完成,就可以在10.0.0.x的任意局域网下挂载Mac通过NFS协议共享出来的tools目录了。



About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK