[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 467
  • Last Modified:

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  ??
 
0
deal2aces
Asked:
deal2aces
  • 2
  • 2
  • 2
  • +1
1 Solution
 
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 new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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
 
deal2acesAuthor Commented:
.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now