Executable command script file

Hi, I’ve recently discovered that both a NomadBSD live USB and a fully installed one can be booted and operated from inside a Virtualbox session, thanks to a specific mod easy to manage. At that point, installing the VB Guest Additions allows to adjust screen resolution and implement shared folder.
However, setting shared folder properties through Virtualbox menu is not enough to make it work in the Virtualbox-NomadBSD session, it needs a terminal command from inside the open session to mount the designated folder as a volume. The command I’ve found works fine, and also found how to modify fstab to have the shared folder automounted as Virtualbox-NomadBSD session boots, but if I do that then the USB volume won’t boot anymore as standalone on my pc. So I just need to have an executable script file which runs the mount command so that the shared folder get mounted just by a doubleclick on such icon-file.
Would you please suggest ho to realize it?
Thank you

try to make a simplest question, I’m looking for what I need in the FreeBSD man pages and research it on Google also, but haven’t found simple answers good for my understanding.

This is the terminal command typed to mount the shared folder in my NomadBSD session:

sudo mount -t vboxvfs hostsharedfolder /home/user/shared/

how do I trasform such terminal command in an executable file to doubleclick when I need it, eventually avoiding the sudo password step?
Thank you

You can create a single-line script and make it executable ( chmod +x ), then you can create a desktop launcher to call that script. Within the sudoers file, you can give anyone permission to run sudo commands without the need of a password. This configuration line, for example, lets anyone in the wheel group run anything without needing the password:

%wheel ALL=(ALL) NOPASSWD: ALL

Granted, there are security risks, but that’s how you would do it. You can edit your /etc/sudoers file using the visudo command. That should give you the result you want.

Thank you Mario, I’m nearly there. Typing visudo /etc/sudoers in a terminal, opened an empty file in which I written the line as you indicated, and saved it. Then created an .sh file containing the command line I need and gave it the chmod +x property.
Doubleclick on it obtain a choice menu asking if I want to run, run in a terminal, open, quit. Just “run” does nothing while “run in a terminal” prompts me for the password. As typed the password and gave return, the command works and the shared folder is mounted. Therefore I presume that the sudoers file has not worked to avoid the password request, or maybe I missed something else.

Just enter visudo without any arguments. You end up in the right file. :slight_smile:

right, that was the point ! :slightly_smiling_face:
Thank you