Announcement

Collapse
No announcement yet.

[SOLVED] Mount SMB share as normal user - how?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Mount SMB share as normal user - how?

    Okay, I'm at the end of my rope.

    All I want to do is access a SMB (windows) share as a regular user. No root access, no messing with SUID bits. This is on Lucid. Groups for the test user(me) are:
    joeusersgroup adm dialout cdrom floppy audio video plugdev lpadmin admin sambashare
    In normal use, they'd not have admin rights.

    mount - no go, can only be run by root.
    smbmount (which maps to mount.cifs) - "mount error(1): Operation not permitted, Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)". Funny, the man page doesn't mention anything about that beyond saying the dreaded "this command can only be used by root". </sarcasm>
    smb4k (as a workaround) - same error as smbmount, besides being about as intuitive as relativity theory.

    Please, someone tell me a regular user can mount a simple godforsaken samba share without root access or messing with SUID bits. I'd also be grateful to learn HOW. Google was absolutely no help btw, most posts were from years past and basically said "use FSTAB!" Right. Normal users don't have access to that. "SUID mount!" er... are you out of your everloving mind? Besides, mount IS already SUID by default. Yadda yadda.

    If I sound a bit cranky... it's because I just wasted a full day trying to do something that should be piss easy and glaringly obvious.

    #2
    Re: Mount SMB share as normal user - how?

    Samba can be a bit of "black art" -- it's certainly not as easy as it should be. Here is pretty good guidance -- it was written for Fedora, and not recently, but the basic list of things to do remains the same: http://www.reallylinux.com/docs/sambaserver.shtml

    You start the smb service running with
    Code:
    sudo service samba start
    You won't really see anything that I would characterize as a "mount event". You just browse to the workgroup and see the connected computers/shares. I use Dolphin, but you can use Konqueror. I have run smb4k and it seems to work fine on my little 4-computer home LAN. You have to be a little patient if you just started the service -- it sometimes takes a few seconds for other computers to show up in the GUI window.

    Here's my personal list of "Duh" moments with samba:

    - the work group name must be exactly the same on the Windows boxes as on the Linux boxes. I always find something to use other than the Windows default "mshome" group, and methodically set it for each computer that is intended to be included in the group, just to make sure they're all the same.

    - %(*&$# Windows firewalls. In Win XP, there are no less than 3 different ways that you need to disable them.


    Hope this helps.

    Comment


      #3
      Re: Mount SMB share as normal user - how?

      Unfortunately still no luck. I can browse shares just fine. I just can't mount them as user. Mounting them as root works of course. Browsing them via Dolphin and such is all nice and dandy, except I can't edit them that way, or create new documents/images/whatever. I need it mounted. As a regular non-privileged user.

      The funny thing - I know my way around Linux. But this one just baffles me. All I ever read says "well, you have to use root to set it up"... or use smb4k - a program which I freely admit makes absolutely no sense to me, as I don't want to browse the share. I want to _mount_ it in the users directory. Which should not ever require any fancy root work.

      Thanks for the help though.

      Comment


        #4
        Re: Mount SMB share as normal user - how?

        Originally posted by steelsnake
        Unfortunately still no luck. I can browse shares just fine. I just can't mount them as user. Mounting them as root works of course.
        Normal users aren't allowed to mount any fileseystem in Linux. It isn't just Samba shares where this restriction exists. Try mounting a hard disk without the power of root and you will fail. Mounting filesystems is properly the job of the system administrator, who presumably has access to root power.

        You might think "well I can insert a data CD or DVD and it gets mounted". That may be true, but you (as Joe Normal user) are not doing the mounting. The mounting is done by a daemon which runs with root privileges. (I don't know the name of it so I welcome clarifications and corrections.)

        Sorry, but if you want the Samba share mounted then you'll need the cooperation of your system administrator to make it happen.

        It occurs to me though that your desire to mount without root may be a misguided attempt at something with a much simpler solution. Why exactly do you think you need the share to be mounted?

        Edit

        It may be possible to allow users to mount (without root) the Sama share by adding it to /etc/fstab with either the user or users options. I've never attempted this, so at your own discretion.
        Welcome newbies!
        Verify the ISO
        Kubuntu's documentation

        Comment


          #5
          Re: Mount SMB share as normal user - how?

          Originally posted by Telengard
          Normal users aren't allowed to mount any fileseystem in Linux. It isn't just Samba shares where this restriction exists. Try mounting a hard disk without the power of root and you will fail. Mounting filesystems is properly the job of the system administrator, who presumably has access to root power.
          As you pointed out in your edit, that is not exactly true...users can be allowed to mount anything (via fstab, policykit etc.) but the decision to allow user mounting is of course in the hands of root.

          @steelsnake
          My recommendation (although I don't know your needs or any special requirements...so it might not be the best choice for you), is to set up the mount in fstab (you do need root access for that, but it's a one time edit after which you should be able to mount/unmout as a user)

          Comment


            #6
            Re: Mount SMB share as normal user - how?

            Originally posted by kubicle
            My recommendation (although I don't know your needs or any special requirements...so it might not be the best choice for you), is to set up the mount in fstab (you do need root access for that, but it's a one time edit after which you should be able to mount/unmout as a user)
            If the Samba share requires a username and password then you'll have to add those to the mount line. The big downside of doing so is that /etc/fstab is globally readable, meaning anyone with physical access to that computer can read the username and password of the Samba share from /etc/fstab. In a home environment this may not be a concern, but it should definitely be a consideration.
            Welcome newbies!
            Verify the ISO
            Kubuntu's documentation

            Comment


              #7
              Re: Mount SMB share as normal user - how?

              Originally posted by Telengard
              Normal users aren't allowed to mount any fileseystem in Linux. It isn't just Samba shares where this restriction exists. Try mounting a hard disk without the power of root and you will fail. Mounting filesystems is properly the job of the system administrator, who presumably has access to root power.
              Not quite true. I can (and regularly do) mount SSHFS (using fuse and keybased auth) volumes as user. That's what I normally use, actually. Users log in, script in Autostart mounts their directories. Users log out, script in shutdown unmounts the directories.

              Originally posted by Telengard
              It occurs to me though that your desire to mount without root may be a misguided attempt at something with a much simpler solution. Why exactly do you think you need the share to be mounted?
              Simple really. I have the occasional "odd" (temporary) machine that runs windows. I need to work with the files on them. As I'm the admin - no problem. However, coworkers also need to access it. Having to set up a share in FSTAB each time is just a waste of time.

              Now, Dolphin can browse the shares just fine. Which of course means they can copy files to/from the share. And that's a royal pain if you just have to look at, say, spreadsheets or text docs. Copy to your HD... then open it... then copy it back... bleh. It simply isn't an acceptable solution.

              Because of this, I'll probably resort to ripping the HD out of such machines, connect it to our server and have it automount into the file storage system.

              At home I have a similar situation, though there I simply switched to SSHFS and poof, no more stupid restriction.

              Originally posted by Telengard
              It may be possible to allow users to mount (without root) the Samba share by adding it to /etc/fstab with either the user or users options. I've never attempted this, so at your own discretion.
              This works, and you can even provide your own per-user connection in this case if you feel like it. Just doesn't solve my problem.

              Comment


                #8
                Re: Mount SMB share as normal user - how?

                Originally posted by Telengard
                If the Samba share requires a username and password then you'll have to add those to the mount line. The big downside of doing so is that /etc/fstab is globally readable, meaning anyone with physical access to that computer can read the username and password of the Samba share from /etc/fstab.
                You can have the authentication information (username and password) on a separate file that is not world readable, and only add the path to the file to fstab with the "credentials" option, so you don't have to expose the information on fstab.

                Of course permission restrictions do not protect against people with physical access to the machine, as physical access is root access.

                Originally posted by steelsnake
                Simple really. I have the occasional "odd" (temporary) machine that runs windows. I need to work with the files on them. As I'm the admin - no problem. However, coworkers also need to access it. Having to set up a share in FSTAB each time is just a waste of time.

                Now, Dolphin can browse the shares just fine. Which of course means they can copy files to/from the share. And that's a royal pain if you just have to look at, say, spreadsheets or text docs. Copy to your HD... then open it... then copy it back... bleh. It simply isn't an acceptable solution.
                Doesn't the samba kioslave allow you to edit files over samba like they were local files (smb:// kio-protocol)?

                Comment


                  #9
                  Re: Mount SMB share as normal user - how?

                  Originally posted by steelsnake
                  Not quite true.
                  Instead of arguing I shall concede that my explanation was oversimplified. I failed to convey an accurate and complete account of what actually happens. I am sorry for that.

                  Having to set up a share in FSTAB each time is just a waste of time.
                  I can see that now, given the new and expanded coverage of your objectives.

                  What you need is a daemon running on client computers with root powers to automount shares as soon as they appear on the network. I don't know whether such a beast exists, but I'll look into it. I think you'd have exactly the same problem even if you were using NFS instead of Samba (although I don't claim to know anything about NFS.) The kind of functionality you're asking for is a bit unusual.
                  Welcome newbies!
                  Verify the ISO
                  Kubuntu's documentation

                  Comment


                    #10
                    Re: Mount SMB share as normal user - how?

                    Originally posted by kubicle
                    Doesn't the samba kioslave allow you to edit files over samba like they were local files (smb:// kio-protocol)?
                    I just tried this in Hardy and it failed. OpenOffice is able to browse to the spreadsheet in the shared folder, but when I click the "open" button nothing happens (no error message either.) Maybe steelsnake is running into the same problem.

                    Network transparency might be a little broken in Kubuntu where Samba is concerned. I don't really know. Hope someone else can explain.
                    Welcome newbies!
                    Verify the ISO
                    Kubuntu's documentation

                    Comment


                      #11
                      Re: Mount SMB share as normal user - how?

                      steelsnake, did you look into either of these possible solutions?

                      FuseSmb
                      smbnetfs

                      Both should be available in the Ubuntu repos.
                      Welcome newbies!
                      Verify the ISO
                      Kubuntu's documentation

                      Comment


                        #12
                        Re: Mount SMB share as normal user - how?

                        Originally posted by Telengard
                        That solved it. Thanks!

                        Comment


                          #13
                          Re: Mount SMB share as normal user - how?

                          Originally posted by steelsnake
                          That solved it. Thanks!
                          You're welcome. I'm glad to know we were able to find a solution which met your requirements.
                          Welcome newbies!
                          Verify the ISO
                          Kubuntu's documentation

                          Comment

                          Working...
                          X