Map windows network drives at login + Linux

Newbie to Linux.

I need to map network drives (Windows) on Linux OS ( CentOS) at start up.
I can map them fine but I need to create a script that will check that they are mapped when the linux OS boots up and if they are not mapped it will map them automatically.

Can anyone help  ??
 
LVL 2
deal2acesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tty2Commented:
Map network drives on Windows? Or on Linux?
There is no "mapping drives" on Linux. Maybe you mean "mount drives"?
Please refine your task.
0
deal2acesAuthor Commented:
I need to mount windows network drives on Linux
0
tty2Commented:
To check if some disk mounted:

mount | grep <mount_point>

To mount some disk if not mounted:

mount | grep <mount_point> || mount <mount_point>

and <mount_point> will be mounted with parameters according to /etc/fstab.
Add this line to cron, and the command will run automatically in some period.
Read man mount, man fstab, man crontab.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

MrVandemarCommented:
You can add the mount to your fstab. Just add a line


//servername/sharename /mountdirectory smbfs username=windowsuserename,password=windowspassword 0 0

It will then be mounted on bootup
0
jar3817Commented:
smbfs is old and slow, use cifs:

mount -t cifs -o username=domainname\\username,password=domainpasswd,rw //ipaddr_or_hostname/sharename /local/folder/to/mount/to

put that line in your /etc/rc.d/rc.local file, it'll run on boot. The "WR" option is for read and write access. There is a double backslash between the domain and the user name to be escaped to domain\username. You could also use the new AD style username: user@ad.fqdn.domain.com
0
MrVandemarCommented:
If you want to use CIFS you can still put it in the fstab, might want to also add the _netdev option. So my previous fstab would be:

for smbfs

//servername/sharename /mountdirectory smbfs username=windowsuserename,password=windowspassword,_netdev 0 0

for cifs

//servername/sharename /mountdirectory cifs username=windowsuserename,password=windowspassword,_netdev 0 0


The _netdev option makes sure it waits till the network is up before it attempts to mount.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
deal2acesAuthor Commented:
.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.