Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Want to add the command

sudo mount -t vboxsf H_DRIVE /media/windows7share

to /etc/init.d/rc.local file, to run the command every time when system starts up but I don't have such a file (rc.local) in that folder. What is the workaround?

share|improve this question
Shouldn't that be /etc/rc.local? – Piskvor Mar 4 '12 at 14:14
filesystems to be mounted at boot are in /etc/fstab, even cifs mounts can be added, with security credentials stored in another file. Search for fstab cifs credentials – bsd Mar 4 '12 at 14:30
@Piskvor it might be. Often /etc/rc.local is a symlink to /etc/init.d/rc.local. – Otheus May 11 '15 at 18:28
Are you sure you are using sysinit? If your system is using upstart or systemd or something similar, there might not be an rc.local. (Unless the system was configured for that). – Otheus May 11 '15 at 18:30

The workaround is to mount the entry in /etc/fstab. It should look something like this:

H_DRIVE    /media/windows7share   vboxsf    defaults        0 0

There's no reason for an RC script (which runs as root) to run 'sudo' to mount the volume. In this case, you don't even need to use an rc script at all.

share|improve this answer

Where the "local" scripts file lies is distro-dependent. Here it is the set of files under /etc/local.d/, some systems will have /etc/init.d/rc.local, others, as Piskvor mentions, may have /etc/rc.local.

According to fedorafaq.org, this file is /etc/rc.local. If there's no such file, create it. Depending on how Fedora does it, the file may need the executable bit (chmod +x).

share|improve this answer
Fedorafaq is wrong about the location. It should be /etc/rc.d/rc.local. Fedora 15 creates a symlink from /etc/rc.local to /etc/rc.d/rc.local, I believe, but Fedora 16 does not, so creating it will do nothing. It must be executable. – jsbillings Mar 7 '12 at 1:06

Another option is using the automounter to mount that partition only if needed. Look at autofs and /etc/auto.mnt for details.

share|improve this answer

I am running Fedora 20. Mounting in fstab fails for me. There is a documented bug that mounting vboxsf in fstab fails at boot time. I moved the mount to /etc/rc.d/rc.local which made with the joyousness.

share|improve this answer

In Fedora 20 (and 21), you should create the file under /etc/rc.d/:

sudo vi /etc/rc.d/rc.local

Inside, add the sh shebang, your command (without "sudo") and exit:

mount -t vboxsf <SHARE_FOLDER> /home/<username>/<HOST>
exit 0

And ensure the file is executable:

chmod 755 /etc/rc.d/rc.local
share|improve this answer
and make sure it's got the +x mode bit set. – Otheus May 11 '15 at 18:34
Good point! Thanks! :) – Paolo Rovelli May 12 '15 at 10:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.