Mounting command samba / share


Forum: Other Help Topics
Topic: Mounting command samba / share
started by: Patrick

Posted by Patrick on Nov. 29 2004,12:16
I use samba.dsl to use a windows share on a other PC. Works nice but i want to automate the mounting of this share.. (put it in a script and behind a hotkey )

I tried:

mount -t smbfs -o username=administrator,password=xxxxxxx //machinename/sharename$ ~/mnt/machinename

It doesn't work...  ( i made the mountpoint before i tried to mount)

error: mount: wrong fs type, bad option, bad superblock on //MN120GHOSTNEW/DSL$,
      or too many mounted file systems

any tips?

Posted by Patrick on Nov. 29 2004,12:46
Got it (thnx to Henk_1955):

smbmount //MN/DSL$ /home/dsl/mnt/MN/DSL$/ -o username=administrator%password,fmask=644,dmask=755,uid=1001,gid=50,ip=xxx.xx.xx.xx,debug=0,workgroup=workgroupname

Posted by mikshaw on Nov. 29 2004,15:00
Your original should still work, with a couple of exceptions.  The mount command won't work as a regular user unless specifically allowed, e.g. in /etc/fstab.  Also, I don't think the mountpoint should contain a tilde, but if I'm wrong, please correct me.

If you want to automate it, you could add the info to /etc/fstab and have it mount on boot....the password would be viewable by all users, though.

Something you might consider, since this is a script, is adding an argument test to the script, backed up by a password prompt:

if [ ! $1 ]; then
echo "enter password"
read pass
else
pass="$1"
fi

I don't know what administrator%password means, though, so this might be unnecessary.

Posted by Patrick on Nov. 30 2004,07:52
The mount-line as you see it works fine (password has to be filled in after the: administrator% though)
Posted by Patrick on Nov. 30 2004,07:59
By the way... The ip-part of the mount-line can be left out!

This is my executable:

mkdir ~/mnt
mkdir ~/mnt/MN120GHOSTNEW
mkdir ~/mnt/MN120GHOSTNEW/DSL$
smbmount //MN120GHOSTNEW/DSL$ /home/dsl/mnt/MN120GHOSTNEW/DSL$/ -o username=administrator%password,fmask=644,dmask=755,uid=1001,gid=50,debug=0,workgroup=WORKGROUPNAME
sudo emelfm /ramdisk/home/dsl/mnt/MN120GHOSTNEW/DSL$

Posted by Kibe on June 18 2005,04:03
Well, I'm quite new both to Linux and DSL, so forgive me for asking this, but someone could post more detailled information about:
1) How this executable can be created?
2) where should it be placed?
3) What file do I need to edit to make it run automaticaly?

Posted by clacker on June 18 2005,14:45
>> Well, I'm quite new both to Linux and DSL,

We all were when we started.

>> so forgive me for asking this

You have achieved forgiveness

>> 1) How this executable can be created?

You create an executable shell script by creating a file in an editor (say beaver) and making the first line:

#!/bin/bash

and adding your lines after that.  When you save the file (named whatever you like, extensions don't matter), run the command chmod 777 myFile (myfile is your file's name)to make it executable.  Then typing the name of that file (if it's in your current directory or in your path) will run that script.

>> 2) where should it be placed?

That depends on you. I'd create in in my home directory (/home/dsl) and then when I knew it worked move it to the /usr/bin directory.

>> 3) What file do I need to edit to make it run automaticaly?

You mean at startup?  I'd put it at the end of the /opt/bootlocal.sh file

Posted by Kibe on June 18 2005,23:40
Thanks for all your answers clacker!

I feel after a long period only using MS trash, I'm using more my brain and I really get excited!

:D

EDIT:

Everything worked fine, all my MP3 stuff is now auto mounted in my small notebook HDD! :D

Except I might remove this from the scrit:

mkdir ~/mnt
mkdir ~/mnt/MN120GHOSTNEW
mkdir ~/mnt/MN120GHOSTNEW/DSL$

Don't see why I should always make those directories...

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.