LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-10-2006, 11:36 AM   #1
vxd
LQ Newbie
 
Registered: Jan 2006
Distribution: Slackware
Posts: 24

Rep: Reputation: 15
Question Mounting SMB shares as non-root


Running slackware 10.2 and I occasionally connect to a windows VPN and need access to shares. As root, I can enter the following and I have access as I would expect

Code:
smbmount //server/myfolder /mnt/share1 -o username=DOMAIN\\myname,password=mypass
If I do the same with my regular user, I get this error message:
Code:
cannot mount on /mnt/share1: Operation not permitted
smbmnt failed: 1
What am I doing wrong?

Thanks,
Tom
 
Old 03-10-2006, 12:15 PM   #2
tomdkat
Member
 
Registered: May 2003
Location: S.F. Bay Area
Distribution: Ubuntu 9.04 AMD64
Posts: 595

Rep: Reputation: 30
Nothing really. Usually, root access is required to mount anything. When you attach USB devices that get mounted automagically, some process with root authority is doing the mount on your behalf.

One thing you can try is use "sudo" to run the smbmount command. Not being able to run smbmount might seem like a pain in the a**, but from a security perspective not allowing regular users to mount devices is a good thing, at least IMO.

Peace...
 
Old 03-10-2006, 12:40 PM   #3
vxd
LQ Newbie
 
Registered: Jan 2006
Distribution: Slackware
Posts: 24

Original Poster
Rep: Reputation: 15
Anything I could do in fstab to make this an easier process? Mounting 10 shares by typing all those isn't exactly "friendly". Note that I have no problem with my users having access (that is what I want).

Thanks,
Tom
 
Old 03-10-2006, 12:50 PM   #4
tomdkat
Member
 
Registered: May 2003
Location: S.F. Bay Area
Distribution: Ubuntu 9.04 AMD64
Posts: 595

Rep: Reputation: 30
Quote:
Originally Posted by vxd
Anything I could do in fstab to make this an easier process? Mounting 10 shares by typing all those isn't exactly "friendly". Note that I have no problem with my users having access (that is what I want).
Yep, you can do something like this:

Code:
//server/myfolder /mnt/share1 smbfs username=DOMAIN\\myname,password=mypass 0 0
The first zero is the 5th field in fstab:
Quote:
Originally Posted by fstab manpage
The fifth field, (fs_freq), is used for these filesystems by the
dump(8) command to determine which filesystems need to be dumped. If
the fifth field is not present, a value of zero is returned and dump
will assume that the filesystem does not need to be dumped.
The second 0 is the sixth field:
Quote:
Originally Posted by fstab manpage
The sixth field, (fs_passno), is used by the fsck(8) program to deter-
mine the order in which filesystem checks are done at reboot time. The
root filesystem should be specified with a fs_passno of 1, and other
filesystems should have a fs_passno of 2. Filesystems within a drive
will be checked sequentially, but filesystems on different drives will
be checked at the same time to utilize parallelism available in the
hardware. If the sixth field is not present or zero, a value of zero
is returned and fsck will assume that the filesystem does not need to
be checked.
See what that does. I've done this kind of thing in the past and it worked fine, except I don't think I specified the DOMAIN\\name in entry.

Peace...

Last edited by tomdkat; 03-10-2006 at 12:52 PM.
 
Old 03-10-2006, 01:16 PM   #5
vxd
LQ Newbie
 
Registered: Jan 2006
Distribution: Slackware
Posts: 24

Original Poster
Rep: Reputation: 15
Added this to fstab via root:

Code:
//server/myfolder /mnt/share1 smbfs username=DOMAIN\\myname,password=mypass 0 0
I logged out and logged in as my linux user. Then did a:

Code:
mount /mnt/share1
mount: only root can mount //server/myfolder on /mnt/share1
So it seems that I'm still required to be root. Willing to try anything at this point =/ Thanks for the help so far.

Tom
 
Old 03-10-2006, 01:25 PM   #6
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Rep: Reputation: 46
You need to make `smbmnt` setuid root in order to have normal users do the mount.
 
Old 03-10-2006, 01:36 PM   #7
vxd
LQ Newbie
 
Registered: Jan 2006
Distribution: Slackware
Posts: 24

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by uselpa
You need to make `smbmnt` setuid root in order to have normal users do the mount.
Not familiar with a command "setuid", but from what I read, the command "chmod u+s /usr/bin/smbmnt" does this. I did and I receive the same error. That command is correct right?

Tom
 
Old 03-10-2006, 01:43 PM   #8
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Rep: Reputation: 46
From `man smbmnt`:
Quote:
smbmnt can be installed setuid root if you want normal users to be able to mount their SMB
shares.

A setuid smbmnt will only allow mounts on directories owned by the user, and that the user has write
permission on.
So I guess your user isn't the owner of the mount point?
 
Old 03-10-2006, 02:55 PM   #9
tomdkat
Member
 
Registered: May 2003
Location: S.F. Bay Area
Distribution: Ubuntu 9.04 AMD64
Posts: 595

Rep: Reputation: 30
Quote:
Originally Posted by uselpa
So I guess your user isn't the owner of the mount point?
Looks like each /mnt/shareX mount point will need to be owned by each user who will be mounting SMB shares.

When I setup fstab to mount SMB shares, I wanted it to be done at boot time and not on-demand.

As a test. make /mnt/share1 owned by your userid and see if you can mount it on-demand.

Peace...
 
Old 03-10-2006, 03:22 PM   #10
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Rep: Reputation: 46
Quote:
Originally Posted by tomdkat
When I setup fstab to mount SMB shares, I wanted it to be done at boot time and not on-demand.
In that case, there's no problem because root will mount the shares. But that is not what the OP wanted.

Another way of mounting on demand without the problem you mention is using sudo.
 
Old 03-10-2006, 03:43 PM   #11
tomdkat
Member
 
Registered: May 2003
Location: S.F. Bay Area
Distribution: Ubuntu 9.04 AMD64
Posts: 595

Rep: Reputation: 30
Quote:
Originally Posted by uselpa
In that case, there's no problem because root will mount the shares. But that is not what the OP wanted.
Yep, I didn't figure out that he wanted his users to be able to do the mounts themselves, on-demand, until later on.

Quote:
Another way of mounting on demand without the problem you mention is using sudo.
Myabe put the sudo command in a script so the users type a command link "winmount [sharename]" and that share is mounted via sudo under the covers?

Additionally, if superuser access is required to mount the SMB share, I imagine there might be some permissions issues that would need to be worked out after the share is mounted. The user mounting the share might want read/write access to it.

Peace...
 
Old 03-10-2006, 07:47 PM   #12
vxd
LQ Newbie
 
Registered: Jan 2006
Distribution: Slackware
Posts: 24

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by uselpa
From `man smbmnt`:


So I guess your user isn't the owner of the mount point?
Bingo! Totally forgot. Thanks a ton!

Tom
 
  


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
mounting smb shares towel401 Linux - Networking 4 10-31-2005 06:59 PM
Mounting smb shares john8675309 Linux - Software 3 09-25-2005 09:54 PM
mounting smb shares in Suse 9.2 BlankFrank Suse/Novell 6 01-23-2005 05:32 PM
Mounting SMB shares as a non-root user dmancine Linux - Networking 0 08-24-2004 03:24 PM
mounting smb shares Snerkel Linux - Hardware 6 07-29-2004 01:17 AM


All times are GMT -5. The time now is 08:46 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration