Mounting Samba Shares at boot/login and using script

I have a Server running on desktop, since my aunt that lives with me is taking classes for MS office it is currently booting XP, so i have setup sharing of all my drives so i can access my files

but how can i auto mount those drives at boot and also with help of script? i need the script cause I'm often messing around on laptop and tend to loose connectivity so the scripts need to unmount and den remount, sort of like a referesh.

I have no user id or pass setup on Windows and the drives NTFS permission is set to allow everyone.

how do i achieve what i need?

PS: i managed to create a script but it asks for password every time it mounts a share!!!


The best way to do this is to create an entry in your /etc/fstab. This is the file that handles automatically mounting drives. If you have no credentials set and don't care about security, you would need to add a line like this:

//fileservername/path  /media/fileshare  cifs  username=guest,iocharset=utf8,file_mode=0777,dir_mode=0777,nobootwait   0   0

Replace fileservername/path with the hostname (or IP address) of the PC that is sharing the files, and the share name. /media/fileshare is where you want to mount the share locally. This directory must already exist. When you need to re-mount this drive, say after a connection loss, etc. use the following:

sudo mount -a

That will attempt to remount any filesystems mentioned in fstab.