# [solved]mounting samba shares at boot

## m0021

hi,

i'm have a problem monting my samba shares at boot-up. i added wicd to the runlevel boot and netmount to the runlevel default, but its not working. the error in rc.log is "network is unreachable". once the boot-up process ended and i'm logging in i can mount my samba shares as root. i want that to work automatically.Last edited by m0021 on Fri Jul 16, 2010 8:28 am; edited 1 time in total

----------

## audiodef

Instead of doing this at boot, do it upon login. Wicd needs a few seconds to connect to an access point, which is what's holding you up. 

The easiest way to do this is to put your mount commands in .bashrc or something that runs when you log in.

----------

## kimmie

Another way to do this is with net-fs/autofs... you can configure this to mount your shares automatically when you access the mountpoint directory. It will also unmount (after a time) when you stop using them.

----------

## m0021

problem is that (how it seems) commands in .bashrc are not executed as root, how can i solve this?

to put mount in sudoers as command that can be executed without password and then "sudo mount -t cifs ..." in .bashrc seems to be very unsecure...

----------

## kimmie

I wouldn't put the commands in .bashrc... what happens when you log in twice?

I think going back to what you were doing with netmount should be fine, with one addition... make netmount wait for your wireless \network to come up. Have a look in /etc/conf.d/rc, probably setting RC_STRICT_NET_CHECKING=yes will do what you want.

EDIT:

 :Exclamation:   Apologies, I'm not familiar with wicd; from the quick look I just had it takes over from the gentoo net scripts, so RC_STRICT_NET_CHECKING isn't going to work

However, from a quick google, it seems that wicd has some configuration parameter called a "post-connection" script. You could set that up to run "/etc/init.d/netmount start" and remove netmount from all runlevels; that way wicd should start the netmount when the connection is ready. Presumably, wicd is running as root.

----------

## m0021

creating a post-connection script worked, thank you for your good idea

----------

