Allow non root user to mount nfs share on Ubuntu

Posted August 13, 2019 7.1k views

I am trying to mount nfs share on ubuntu without using “sudo” and getting below error.
operation permitted for root only
Can someone please help me to allow active directory domain user to mount nfs share in the server. Server is already configured with LDAP, I am able to login with my LDAP account on the server.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers


Only the root user can specify options to the mount command, but you can still do this with only using the target from fstab as argument. You can edit /etc/fstab as root and set this there.

Then you can mount the nfs share manually in CLI

Once this is done you can use the following commands in order to auto mount the nfs on boot:

trail -1 /etc/mtab
trail -1 /etc/mtab >> /etc/fstab

If you can let me know what exactly you’re trying to achieve (e.g give me the exact directories and the options you want to use) I can further help you to set this.

Let me know how it goes.


I want to use SFTP to store backup of different applications in our Infrastructure and have deployed Ubuntu server which has built in SFTP. Everything works fine if I use local account and local directory to store backups.I have used below link to configure it

Now, to store backup, I want to mount NFS or CIFS share.
1) My initial challenge is that I cannot mount NFS/CIFS share without “Sudo”.
2) If I use kerbros authentication at NFS server level then I am not able to mount the share, may be because I am using “ Sudo"and NFS server does not authenticate that.I am not sure how to mount NFS share using LDAP credentials.
3) I am able to mount CIFS share using Sudo mount -t CIFS -O LDAPUsername Password, where username is the user who has permission on that CIFS share.
4) Now, as I have mounted the CIFS share on the server, I want to use LDAP account to copy data on CIFS share from application.

CIFS/NFS share - testbackup
Directory on which CIFS/NFS share is mounted - /sftp/backup
Path on which Application should store the backup - /sftp/backup/application1 (Similarly any other application is there then /sftp/backup/application 2 or 3 and so on)
I tired changing the ownership of /sft/backup directory to ldap account using "sudo chown LDAPusername /sftp/backup” but it does not change the ownership and still shows root account as owner.
I want LDAP user to have privileges on /sftp/backup directory and use that account to write backup under this directory remotely from the application.
Apologies, if I have missed something as I do not have much experience in managing linux based systems and configuring this for the first time.

by Mateusz Papiernik
SFTP stands for SSH File Transfer Protocol. As its name suggests, it's a secure way of transferring files to a server using an encrypted SSH connection. In a standard configuration, the SSH server grants file transfer access and terminal shell access to all users with an account on the system. In this tutorial, we'll set up the SSH daemon to limit SFTP access to one directory with no SSH access allowed on per user basis.