linux-noob.com/forums: How to mount a Windows share with smbmount - linux-noob.com/forums

Jump to content

Page 1 of 1

How to mount a Windows share with smbmount Quick example of the usage of smbmount

#1 User is offline   znx

  • Linux-Noob GURU
  • PipPipPipPipPipPipPipPip
  • View blog
Group:
Members
Posts:
1,220
Joined:
21-March 05

Posted 21 March 2005 - 11:52 PM

After seeing the how to mount a fat32 partition I thought I'd show you how to mount a share.

First off you need to make sure the share it setup correctly on your Windows system, I'll only focus on sharing with WinXP.

Its not hard on WinXP. First off right-click on the folder you wish to share and select "Sharing and Security".

Select "Share this folder".

You can now set the Share name, you can also fiddle with the maximum number of users allowed at one time (the default is normally good enough).

If you want to heighten the security in this share you can click on "Permissions" and remove the default "Everyone" group (select and click Remove). After this you can click Add. Type the username that will be used to allow access (this has to be a valid user on your WinXP machine). Click Ok, and Ok again. The folder icon should alter and a hand will be holding the folder. This indicates a network share.

Ok so you need to know these things:
The hostname of the WinXP PC (eg winpc). Right click on "My Computer" click on "Computer Name". Look at the "Full Computer Name".

The sharename of the folder (eg shared) Do you remember what you called it tongue.gif.

A user/pass for the winxp system. This is only required if you altered the permissions (i.e. if its not sharing to Everyone).

Phew 50% of the way there.

Ok so onto the Linux system, its relatively simple:

Make the directory you want to mount the share to.
CODE
mkdir /mnt/share


Next either...

Mount the share with user/pass:
CODE
smbmount //winpc/shared /mnt/share -o username=user,password=pass,rw


Or mount the share without a user/pass (this is true if Everyone is still set)
CODE
smbmount //winpc/shared /mnt/share -o rw


Hopefully thats it. Now you can use the share. You cannot create symbolic links or chmod the system (this is restriction on the WinXP side).

If you wish to allow users on the linux side access to the share then you will need to alter the options. Adding in uid= or gid= to allow access to users or groups respectively by mounting the drive with there permissions. Here's an example:

CODE
smbmount //winpc/shared /mnt/share -o rw,uid=znx


This will mount the drive as if user znx had done it. Thus he will have rw access to the shared.

Hands up who I managed to confuse wink.gif
Bye
0

#2 User is offline   znx

  • Linux-Noob GURU
  • PipPipPipPipPipPipPipPip
  • View blog
Group:
Members
Posts:
1,220
Joined:
21-March 05

Posted 25 February 2006 - 11:14 PM

Decided to append some more to this:

Make a file /root/.creds (you will be root!)
CODE
username = znx
password = mypassword


Make sure the file is closed permissions...
CODE
chmod 0600 /root/.creds


Now edit /etc/fstab and add a line for the share:
CODE
//winpc/shared  /mnt/share  smbfs  credentials=/root/.creds,rw,uid=znx  0  0


Now the share can be mounted just by doing:
CODE
mount /mnt/share


Simple enough happy.gif
Bye
0

#3 User is offline   znx

  • Linux-Noob GURU
  • PipPipPipPipPipPipPipPip
  • View blog
Group:
Members
Posts:
1,220
Joined:
21-March 05

Posted 03 May 2006 - 04:54 PM

A problem was encountered using the smbmount command saying something like:

CODE
Usage: mount.smbfs service mountpoint [-n] [-o options,...]" followed by the list of options and "This command is designed to be run from within /bin/mount by giving the option '-t smbfs'.


You can overcome this using the mount command:

CODE
mount -t smbfs -o username=USER,password=PASS //server/share /mnt/share


Replacing USER/PASS as before.
Bye
0

#4 User is offline   znx

  • Linux-Noob GURU
  • PipPipPipPipPipPipPipPip
  • View blog
Group:
Members
Posts:
1,220
Joined:
21-March 05

Posted 15 May 2006 - 04:06 PM

Expanding again smile.gif

If you wish to open access to other users you can use the "umask" option with mount. You will need to understand the octal modes for file permissions a little to use this fully.

For instance:
umask 022 relates to 755 rwxr-xr-x (755 + 022 = 777).

If you are confused by this you can use umask=000 .. this will give read/write/execute permissions to ALL users.

Now to show umask in both the command line:

CODE
mount -t smbfs -o username=USER,password=PASS,umask=022 //server/share /mnt/share


And in fstab:

CODE
//winpc/shared  /mnt/share  smbfs  credentials=/root/.creds,rw,umask=022  0  0


Using umask allows you to adjust the permissions of the mounted share.

Summing up you can therefore control user (uid=), group (gid=) and permissions (umask=) on the mounted share.
Bye
0

#5 User is offline   Shadowcat

  • Noob
  • Pip
Group:
Members
Posts:
20
Joined:
05-January 05

Posted 21 May 2006 - 10:19 PM

bah edit the original post lazybones tongue.gif


Which post .. ? [znx]
# aptitude install life
Couldn't find package "life".
#
0

#6 User is offline   Andy72

  • Noob
  • Pip
Group:
Members
Posts:
3
Joined:
10-July 06

Posted 10 July 2006 - 02:40 PM

Thanks a lot for this guide!!

I followed your first example, the one without user/password and got it works superb :-)

But, How do I save this setting, dont want mount it manually evereytime I restart the computer...

I Have tried to edit the fstab but get error, can someone help a real Noob with a coode that NOT supose to have a password or username.... (i have a xbox and other stuff conected to the network and want not to setupp password, yes I m lazy...)

BR /Andreas

_________
Edit:
This line works good in fstab:
//servername/sharename /media/sharename smbfs rw 0 0

But after restart I need to type sudo mount -a

So again, why does my Kubuntu not automatically do this during restart...
0

#7 User is offline   znx

  • Linux-Noob GURU
  • PipPipPipPipPipPipPipPip
  • View blog
Group:
Members
Posts:
1,220
Joined:
21-March 05

Posted 10 July 2006 - 09:53 PM

QUOTE (Andy72 @ Jul 10 2006, 02:40 PM) <{POST_SNAPBACK}>
Thanks a lot for this guide!! I followed your first example, the one without user/password and got it works superb :-)


Yay!

QUOTE (Andy72 @ Jul 10 2006, 02:40 PM) <{POST_SNAPBACK}>
So again, why does my Kubuntu not automatically do this during restart...


You are there, any normal system would auto mount that with no issues.

Interestingly enough I know why this is. There is a bug with kubuntu (and ubuntu) that means it will hang if samba is auto mounted from fstab. I believe it has to do with the kernel module not being installed early enough.

So to work around this, do the following:

/etc/fstab add the "noauto" option to ensure that its not going to be auto mounted.
CODE
//servername/sharename /media/sharename smbfs rw,noauto 0 0


The open up /etc/rc.local (make one if its not there) and add:
CODE
mount /media/sharename


By the time that rc.local is run the kernel module will be there and all should be well (proof of this is your ability to mount -a after its all booted).

happy.gif
Bye
0

#8 User is offline   Andy72

  • Noob
  • Pip
Group:
Members
Posts:
3
Joined:
10-July 06

Posted 11 July 2006 - 05:21 PM

Hi, think I'm need some more help! :-(

Fixed the noauto and the fstab and restarted the computer, but the disk are not mounted (and it.s now not possible to use the mount -a command because the noautu).

As before when I click on the icon for the share folder in desktop I get the messege that only root can mount it... (I have even added more rights to the useracount besides admin also root, disks...)

Is there a way to verify that the rc.local has been started? It works fine if I type sudo /etc/rc.local (and password) in the terminal...
0

#9 User is offline   znx

  • Linux-Noob GURU
  • PipPipPipPipPipPipPipPip
  • View blog
Group:
Members
Posts:
1,220
Joined:
21-March 05

Posted 11 July 2006 - 09:41 PM

QUOTE (Andy72 @ Jul 11 2006, 05:21 PM) <{POST_SNAPBACK}>
Hi, think I'm need some more help! :-(


Ah .. my fault I think, do this:
CODE
chmod +x /etc/rc.local


Adding executable permissions to it.

If it runs the script .. you should see (as the last thing) something like:
CODE
* Running local boot scripts


Or similar.
Bye
0

#10 User is offline   Andy72

  • Noob
  • Pip
Group:
Members
Posts:
3
Joined:
10-July 06

Posted 12 July 2006 - 07:02 PM

Thank you for your patience with me, but I’m sorry to say that it still not working. It´s exactly the same as before, and I not sure that I can see something like running any boot scripts during the boot up (its sweep away very fast in the end, and can not break/pasue)…

If you have any more idea I’m happy too hear them otherwise it’s ok, I now it’s not easy to serve computers from distance… :\

I have done some progress with Linux anyway, I can now log into linux from my windows pc, so its works auto from that direction (that way I need password, maybe I find a solution to shut it off)!
0

#11 User is offline   samssf

  • Noob
  • Pip
Group:
Members
Posts:
1
Joined:
20-September 06

Posted 20 September 2006 - 02:17 AM

You people need to stop posting answers to questions unless you know your advice will work. I've lost about 30 hours in the last 4 days because of this.

I too have the same problem.

I installed Ubuntu 6.06 dapper drake as dual boot. Followed instructions and installed it correctly. Everything is great... except whenever I click on a drive in "Computer" I get a message that says "Only root can mount /dev/sdc1". And yes, I have tried everything I can think of. My fstab looks fine. I've tried sudo and sudo su to root.

Helpful suggestions please. Obivously lots of people have had this issue if I received the error on a clean install.
0

#12 User is offline   anyweb

  • Administrator
  • PipPipPipPipPipPipPipPip
  • View blog
Group:
Admin
Posts:
2,965
Joined:
11-December 03

Posted 20 September 2006 - 06:24 AM

QUOTE
samssf Posted Today, 01:17 AM
You people need to stop posting answers to questions unless you know your advice will work. I've lost about 30 hours in the last 4 days because of this.
if we don't post howto's then how will people learn ?

QUOTE
I installed Ubuntu 6.06 dapper drake as dual boot. Followed instructions and installed it correctly. Everything is great... except whenever I click on a drive in "Computer" I get a message that says "Only root can mount /dev/sdc1".


ok lets be clear here, are you trying to mount ANOTHER computers (windows xp) 'share' or are you trying to mount your dual boot NTFS drive ? To be clear, THIS POST is about how to mount ANOTHER computers share from within linux, it is not about how to mount an NTFS drive/partition within linux.

if that's the case then you need to read the 'how to mount an NTFS drive in 5 minutes or less... post'

if this is not the case then please give us details of what you have tried and what your exact error is,

the more details the better, oh and welcome to the forums,

cheers
anyweb
My linkedin profile at > linkedin.com
My personal website is > niallbrady.com
0

#13 User is offline   znx

  • Linux-Noob GURU
  • PipPipPipPipPipPipPipPip
  • View blog
Group:
Members
Posts:
1,220
Joined:
21-March 05

Posted 20 September 2006 - 01:03 PM

QUOTE (samssf @ Sep 20 2006, 02:17 AM) <{POST_SNAPBACK}>
/dev/sdc1


That is a local drive, what this howto is for is remote windows share. Check out the link that anyweb provided.

It should be made clear to all, this tutorial requires two separate machines, one a linux system the other a windows system, I'm sorry if there was any confusion with regards to this.
Bye
0

#14 User is offline   dustman

  • Noob
  • Pip
Group:
Members
Posts:
2
Joined:
16-November 07

Posted 16 November 2007 - 10:26 PM

i tried all the methods stated in this thread, but all i get is this
CODE
dustman@dustman-laptop:~$ smbmount //smb://ionut/ /home/dustman/Muzica/jean/ -o ro
11060: Connection to smb: failed
SMB connection failed


where "//smb://ionut" is the network path of the share folder i want to mount, and "/home/dustman/Muzica/jean/ " is the path i want to mount the share folder

With the second method i get:
CODE
dustman@dustman-laptop:~$ sudo mount -t smbfs -o guest //smb://ionut /home/dustman/Muzica/jean/
11318: Connection to smb: failed
SMB connection failed


basicly the same stuff as the first method. What am I doing wrong? :|


P.S. the network has only two users...my laptop and "ionut" computer...so there are no username and password set. In windows it works like a dream, but in ubuntu is doesn't sad.gif
0

#15 User is offline   znx

  • Linux-Noob GURU
  • PipPipPipPipPipPipPipPip
  • View blog
Group:
Members
Posts:
1,220
Joined:
21-March 05

Posted 21 November 2007 - 02:37 PM

Remove the //smb: from the front of your lines. It sees the smb: as the name of the PC its trying to connect to!

CODE
$ smbmount //IPADDRESS/ionut /home/dustman/Muzica/jean/ -o ro


Or

CODE
$ sudo mount -t smbfs -o guest //IPADDRESS/ionut /home/dustman/Muzica/jean/


There we go smile.gif
Bye
0

#16 User is offline   dustman

  • Noob
  • Pip
Group:
Members
Posts:
2
Joined:
16-November 07

Posted 21 November 2007 - 09:13 PM

QUOTE (znx @ Nov 21 2007, 03:37 PM) <{POST_SNAPBACK}>
Remove the //smb: from the front of your lines. It sees the smb: as the name of the PC its trying to connect to!

CODE
$ smbmount //IPADDRESS/ionut /home/dustman/Muzica/jean/ -o ro


Or

CODE
$ sudo mount -t smbfs -o guest //IPADDRESS/ionut /home/dustman/Muzica/jean/


There we go smile.gif


yes, yes....it's working biggrin.gif i figured it out.... thank you for answering smile.gif


Cheers!


Radu
0

#17 User is offline   Dungeon-Dave

  • Linux-Noob Frequent Member
  • PipPipPip
  • View blog
Group:
Moderator
Posts:
131
Joined:
24-September 08

Posted 24 September 2008 - 09:04 PM

Just a quick footnote: "smbfs" should now read "cifs" for newer versions of SAMBA. I can't tell what version it changed; I know SMBFS still works on my FC4 home box but not on my Fed7 server at work (had to use CIFS).
0

Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users





The G2-style Tux and the header images using them are licensed under Creative Commons BY-NC-SA. The G2-style Tux images are all from http://crystalxp.net.
Thanks to users kami23, lilitux, iva, overlord59, whidou, brightknight, emulienfou on the Crystal XP Tux Factory site.