LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can I use a scrip to mount a drive on network? (https://www.linuxquestions.org/questions/linux-newbie-8/can-i-use-a-scrip-to-mount-a-drive-on-network-177568/)

Tiyogi 05-03-2004 09:59 PM

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 ??

TheRealDeal 05-03-2004 10:31 PM

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 :)

TheRealDeal 05-03-2004 10:34 PM

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 :)

Tiyogi 05-04-2004 07:17 AM

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.

TheRealDeal 05-05-2004 03:02 AM

No problem, glad I could help.

See ya round.

>Craig :)


All times are GMT -5. The time now is 09:44 PM.