大网数据广告活动
服务器运维问答

NFS - user mapping

· 52CE 我爱测

I have folder mounted from remote server to local: mount -o nolock 92.xxx.xxx.xxx:/var/www/html/static/data /home/myaccount/public_html/forum/data_remote The problem is, that local account is of UID 500 and remote is 48, so I can…

问题原文

原帖链接 · pwas · CC BY-SA 3.0

I have folder mounted from remote server to local:

mount -o nolock 92.xxx.xxx.xxx:/var/www/html/static/data /home/myaccount/public_html/forum/data_remote

The problem is, that local account is of UID 500 and remote is 48, so I cannot write any contents to local data /home/myaccount/public_html/forum/data_remote - because of permission denied error.

Here is my /etc/exports:

/var/www/html/static/data/      5.xxx.xxx.xxx(rw,insecure,no_root_squash)

What can I do to map properly permissions to allow myaccount to write to remote folder?

已采纳解答

原帖链接 · Nasir Riley · CC BY-SA 4.0

You will have to change the UID to match what is on the remote server. Before doing this, make sure that your user account is not executing any processes.

usermod -u NEWUID username

Keep in mind that any files outside of your home directory will have to have their ownership changed manually. You can do that with this command on the system where you changed the UID:

find / -user OLDUID -exec chown -h username {} \;

This will give you the same UID on each system which will allow you to write to the remote directory and modify the files. It may be easier to do it on the remote machine if you aren't using it regularly and have less files on it assuming that you have the access to do so.

You can also do the same by creating a group with the same GID on each machine and adding your user to the group on the machine where you're trying to connect to the shares.

On each machine:

groupadd -g GID groupname

On the machine hosting the NFS shares:

chown :groupname /nfs/share

On the machine connecting to the shares:

usermod -aG groupname username

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-02-22)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。