@Rico_Lino and @PuckStar since you both asked for this:
Here we go.
The way I do it requires samba and cifs-utils.
If you don’t mind installing/having this on your machine then follow along:) Otherwise, don’t use this info.
One needs to install the dependencies:
sudo apt-get install samba-common smbclient samba-common-bin smbclient cifs-utils
After that create a folder that will be used as the mount point for the network share:
sudo mkdir -p /media/YourFolder (you can pick any path you want -We’ll use this one for this example).
Change ownership (to the user this will be executed under via init.d)
sudo chown pi:pi -R /media/YourFolder
My share (in order to avoid users and passwords has guest access enabled read/write) and I mount it with:
sudo mount.cifs //192.168.1.1/share/ /media/YourFolder -o guest
You can run that command (we’ll have that executed at boot via init.d) to mount/test it.
To see if it mounted run
df -h and you should see it there.
Now, to have it executed at boot, you need to create a file in init.d that will execute this at system boot.
sudo nano /etc/init.d/sharemount (or name it however you want)
We’ll need to set the header for it so that the command is executed when the dependencies are loaded (in this case $local_fs $remote_fs $network).
Here is the code that needs to be placed in sharemount:
# init script for sharemount
### BEGIN INIT INFO
# Provides: sharemount
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: S
# Default-Stop: 0 1 6
# Short-Description: sharemount
### END INIT INFO
case "$1" in
sudo mount.cifs //192.168.1.1/share /media/YourFolder -o guest
/sudo umount /media/YourFolder
What this does is it waits for the resources to be loaded and 10 seconds later, it mounts the shared path via the command.
On computer restart or shutdown, it unmounts it (optional).
Once the above content is saved in the file, you need to
sudo chmod 775 /etc/init.d/sharemount in order to make it executable and then
sudo update-rc.d sharemount defaults to enable it at boot.
Hope this works for you. Might not be the cleanest way, but this has been been stable/working for me for quite some time now.
Change IP’s and paths to your need.