2
// mount samba directory
sudo mount -t cifs //$host/$path $mountpath -o username=$user,noauto,user,uid=1001,gid=1002,forceuid,forcegid
//mount remote ftp
echo $key | sshfs $user@$host: $mount -C -p $port -o idmap=user -o password_stdin

The first command I have to perform by using sudo privilege, otherwise mount.cifs: permission denied: no match for XXXX found in /etc/fstab prompted.

However, second command that i issue can be success without using sudo privilege.

  1. Both commands are mounting remote directory to linux file systems, but why behave different?

  2. I thought mount action need to be performed by privilege user to ensure security policy, am I misunderstanding any ?

  3. Can a user mount file while no sudo privilege permission given?

1 Answer 1

2

It depends on a specific filesystem.

sshfs is FUSE (filesystem in userspace) and does not require superuser privileges.

CIFS is a kernel module, and requires root. See: Is the CIFS driver user-mode or kernel-mode?

If you want to mount cifs shares as a regular user, use sudo. See: What sudoer spec allows users to mount cifs shares?

There is also fuse-nfs https://github.com/sahlberg/fuse-nfs

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.