LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-03-2004, 09:59 PM   #1
Tiyogi
Member
 
Registered: Nov 2003
Location: Hyde Park, Ny
Distribution: Ubunta
Posts: 117

Rep: Reputation: 15
Can I use a scrip to mount a drive on network?


Can I use a scrip to mount a drive on network?

I have a second computer networked to my linux box.

I know how to mount the drives on the other computer using a terminal and a command to mount the drives on the other computer.

mount -t smbfs -o [username=ed] //iwill/i_iwill /mnt/i_iwill

Can I turn this into a script and place it on my desktop so when I want the drive mounted all I do is double click and it is mounted.

I do not want to have them mounted all the time, where in I use fstab, because the other machine is not always on. I just want it sometimes.

I have googled tryed to find out how to do this but I have been unsuccessful so far.

I have tryed writing a fes scipts but nothing has worked so far.

They have been basically like this


#!/bin/sh
xterm
mount -t smbfs -o [username=ed] //iwill/i_iwill /mnt/i_iwill


But this does not seem to work.
Can anyone help me with this ??
 
Old 05-03-2004, 10:31 PM   #2
TheRealDeal
Member
 
Registered: Jun 2003
Location: Central Coast, NSW, Australia
Distribution: Gentoo
Posts: 438

Rep: Reputation: 30
Hi.

I do the exact thing you are asking I have a couple of scripts on my desktop that I run when I want a certain share mounted.

The only thing different I do to what you have written above, is I have made a credentials file which contains my username and password. If you use the above example that you have written, it won't work because it will also need a password.

You have two options, first being, add the password into your script, or second, use a credentials file. Depends on how secure you want it really. If anyone comes along and views your script, they will see your password.
If you are worried about this, use a credentials file.

>Craig
 
Old 05-03-2004, 10:34 PM   #3
TheRealDeal
Member
 
Registered: Jun 2003
Location: Central Coast, NSW, Australia
Distribution: Gentoo
Posts: 438

Rep: Reputation: 30
Here you go.

I should've put these up as well for you....

***************
#!/bin/bash
mount -t smbfs -o username=ed,password=edspassword //iwill/i_will /mnt/i_will
***************

that should get it going for you. the mount line should all be on the same line aswell of course.

Let me know how you go.

>Craig
 
Old 05-04-2004, 07:17 AM   #4
Tiyogi
Member
 
Registered: Nov 2003
Location: Hyde Park, Ny
Distribution: Ubunta
Posts: 117

Original Poster
Rep: Reputation: 15
Thanks TheRealDeal,
That was just what I needed.

Now I can mount and umount my drives at will.

When I was googling for info on this there were tons of info but all it was for complexe operations. I just could not pin down this simple operation.

This seem to be one of the problems with learning linux. That is many sites with information on them assume that you want to do this killer script writing. When all you want to do is a very simple thing. ( Time to get off my soap box)

Anyway thanks again for the helpful reply.
 
Old 05-05-2004, 03:02 AM   #5
TheRealDeal
Member
 
Registered: Jun 2003
Location: Central Coast, NSW, Australia
Distribution: Gentoo
Posts: 438

Rep: Reputation: 30
No problem, glad I could help.

See ya round.

>Craig
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I mount a Network Drive surfduke SUSE / openSUSE 1 01-21-2005 09:17 AM
Auto Mount a Network Drive thebutler4 Linux - Newbie 3 06-23-2004 09:56 PM
Auto-mount a network drive agarnier Linux - Networking 4 10-29-2003 07:09 AM
How do i mount a network drive? yenonn Linux - Networking 1 03-10-2003 01:57 AM
How can i mount to the network drive? yenonn Linux - Newbie 1 02-25-2003 10:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration