SMB Mount Script? Something like a batch file, how is it done?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
SMB Mount Script? Something like a batch file, how is it done?
Hello.
I'm FAIRLY new to linux, I have a bit of experience, but I'm mostly proficient in Windows.
I'm using ubuntu through VMware on a Windows XP based laptop that I take both to work and home.
At work, I have 4 Windows Shares that I want to mount, and at home I have a couple as well.
If I could make some sort of batch file like in Windows, I'd know how to get started on what I'm trying to accomplish, but basically, this is what I'm trying to accomplish.
1- script I can run to mount 2 mapped drives at home.
2- script I can run to umount 2 mapped drives at home.
3- script I can run to mount 4 mapped drives at work.
4- script I can run to umount 4 mapped drives at work.
I need these things to be independent, because if I'm connected with VPN (either way) I'd like to be able to mount all at once.
Lastly, and this I think will become very tricky, I'd like to make a script that I can run that will mount a windows share with an IP that changes all the time. The reason for this is that the version of VMWare I'm running doesn't support "shared files" and I'd like to access the files on the C drive of my host system. I can do this by mounting to it's IP address but it changes, and I can't seem to get my linux distro to recognize it by hostname (I suppose fixing that problem might be easier).
Any help?
heh, I fully expect after all that typing, I get NO replies...
I'm FAIRLY new to linux, I have a bit of experience, but I'm mostly proficient in Windows.
I'm using ubuntu through VMware on a Windows XP based laptop that I take both to work and home.
At work, I have 4 Windows Shares that I want to mount, and at home I have a couple as well.
If I could make some sort of batch file like in Windows, I'd know how to get started on what I'm trying to accomplish, but basically, this is what I'm trying to accomplish.
1- script I can run to mount 2 mapped drives at home.
2- script I can run to umount 2 mapped drives at home.
3- script I can run to mount 4 mapped drives at work.
4- script I can run to umount 4 mapped drives at work.
I need these things to be independent, because if I'm connected with VPN (either way) I'd like to be able to mount all at once.
Lastly, and this I think will become very tricky, I'd like to make a script that I can run that will mount a windows share with an IP that changes all the time. The reason for this is that the version of VMWare I'm running doesn't support "shared files" and I'd like to access the files on the C drive of my host system. I can do this by mounting to it's IP address but it changes, and I can't seem to get my linux distro to recognize it by hostname (I suppose fixing that problem might be easier).
Any help?
heh, I fully expect after all that typing, I get NO replies...
The startup scripts are in /etc/rc2.d
and the /etc/fstab says all about mounting drive to location : all is possible there.
I do have a couple of mount points in fstab now, but that's not what I'm after. The issue with that is, when I'm not connected to both networks, only the drives it can reach are mapped. I don't want it at bootup, I want to do it on the fly.
Also, since I've done the fstab thing, there seems to be an issue shutting down the OS cleanly, I have to tell VMWare to do a hard shut down after it tries. I'm not sure yet that it is an fstab issue yet, though.
I learned how to make shell scripts, but the only way to run them was to do a command with "bash [script name]", not something I could click on or stick in the menus.
If I put all my desired drive mappings in fstab, if they aren't all connected when I login, I can run "mount -a" and it will refresh the fstab list and look for those drives again.
"umount -a" removes everything mapped in fstab.
This will work for now, it's not ideal but it's decent.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.