14

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?

hellb0y77
  • 955
  • 5
  • 11
  • 21
  • What error do you get when you manually try to mount it? `mount -a` What error(s) show up in your NAS logs? – Aaron Jan 20 '16 at 15:12

2 Answers2

14

I found the error, i need insert username instead of user

192.168.0.1:/NASShare  /mnt/NAS  nfs username=administrator,password=pass  0 0
hellb0y77
  • 955
  • 5
  • 11
  • 21
3

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.