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

fstab entry to mount NFS with password

· 52CE 我爱测

i need mount at boot a disk using NFS, to mount manually from console i type: mount //192.168.0.1/NASShare -o username=administrator,password=pass /mnt/NAS To /etc/fstab i added this line: 192.168.0.1:/NASShare /mnt/NAS nfs user=…

问题原文

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

i need mount at boot a disk using NFS, to mount manually from console i type:

mount //192.168.0.1/NASShare -o username=administrator,password=pass /mnt/NAS

To /etc/fstab i added this line:

192.168.0.1:/NASShare  /mnt/NAS  nfs user=administrator,password=pass  0 0

But at reboot the disk is not mounted, where is the error?

社区高分解答

原帖链接 · Heath Loder · CC BY-SA 3.0

You don't specify in your question whether you are trying to use NFSv3 or NFSv4, but neither supports a password parameter. The user parameter isn't even recognized by NFS or mount.nfs, it is handled purely by mount, and essentially allows non-root users to mount the filesystem. The user parameter (or users, if un-mounting is also desired) can be specified by itself with no additional arguments (i.e. mount -t nfs -o user) and indicates that any user can mount the filesystem.

Even after supplying the user option to mount, an NFS export that is listed in /etc/fstab will not be mounted as the logged-in user, because /etc/fstab is sourced before any user is logged in, so it will still be mounted as root. All working solutions that require supplying the user option to mount currently rely on also supplying the noauto option, and then running the mount command manually after login, as the user that you wish to mount the NFS export with.

NFS does not support sending plaintext passwords over the network, so you should never find yourself specifying a password as a mount option.

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

资料来源与适用范围

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

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

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