Announcement

Collapse
No announcement yet.

Simple samba share for sharing files among Kubuntu and VirtualBox guest

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

    Simple samba share for sharing files among Kubuntu and VirtualBox guest

    Hello,

    Today I made fresh Kubuntu 9.04 install, and things look somewhat different than they used to be. I am wondering how to set up a samba share that would allow to share files between Kubuntu and Windows that sits in the VirtualBox VM.

    I'd sort of expect that I can open System Settings, go to Sharing, and there I could edit list of shares that would persist between system reboots. Unfortunately I see there only two textboxes that ask for default username/pwd, that seem to be defaults when connecting to _other_ win shares. No sign of nice list of paths and shares, as visible in tutorial images here: http://kubuntu101.blogspot.com/2005/...ing-samba.html

    Yes, I realise the tutorial is for older version of Kubuntu, but perhaps things have not changed so severely that the list of shares and paths is now gone. No button "Administrator mode" visible either, so can not enjoy the possible beauty of administrator interface. I tried to find out if there is a way how to run the System Settings as admin, found that one can do "kdesudo systemsettings", but that really did not result in any new features in the Sharing applet interface. Does the KDE interface really not have any friendly way how to run things as admin, without need to open up console and type the command (that needs to be looked up somewhere).

    Perhaps I am missing some basic knowledge here, please enlighten a Kubuntu newbie.

    #2
    Re: Simple samba share for sharing files among Kubuntu and VirtualBox guest

    I think there is a bug in the System Settings where the Administation Mode button is missing. If that's the case we should report it in Launchpad because this is a bad thing!

    Two suggestion: maybe upgrading KDE helps?
    http://www.kubuntu.org/news/kde-4.2.4

    Also: is there a context menu (right click) to share folders in Dolphin? (the file manager). I am not at my desktop now to check ...

    Comment


      #3
      Re: Simple samba share for sharing files among Kubuntu and VirtualBox guest

      If your goal is sharing files with the Windows guest in VirtualBox why not use the native support for Shared Folders in VirtualBox. I'm running a similar set-up. I share my /home directory with the Windows guest and it works without issue. I keep my outlook data file on my Linux file system and access it from the XP guest using shared folders, no Samba necessary. I wish it was a little faster but I can't imagine Samba would be any faster. That would be a good benchmark to try out.
      linux && bash = "the future"

      Comment


        #4
        Re: Simple samba share for sharing files among Kubuntu and VirtualBox guest

        I just checked in Dolphin myself. Right click on a folder, Properties, and then Share. Couldn't be more intuitive. It does ask for sudo password!
        Attached Files

        Comment


          #5
          Re: Simple samba share for sharing files among Kubuntu and VirtualBox guest

          Originally posted by lmilano
          I just checked in Dolphin myself. Right click on a folder, Properties, and then Share. Couldn't be more intuitive. It does ask for sudo password!
          I have already tried that trick few days back and again tried just now. It does ask for password when I click on "Configure file sharing" but the problem here is nothing happens after entering the password and pressing enter/ok. I had been wondering if the feature is not yet complete in KDE 4.x

          Any other better suggestions? I am using vmware n trying to do as the original post.
          Sony Vaio VGN-NR160E/T<br />Kubuntu 9.04 KDE 4.3.00

          Comment


            #6
            Re: Simple samba share for sharing files among Kubuntu and VirtualBox guest

            This is a simple smb.conf that i use on my Kubuntu / winxp / 7RC vmware guests:

            workgroup = FINTANHOME
            interfaces = eth0
            map to guest = bad user

            [Data]

            path = /Data
            read only = no
            guest ok = yes
            case sensitive = no
            strict locking = no
            force user = fintan3



            [HP1600]

            printing = cups
            path = /var/tmp
            printable = yes
            guest ok = yes
            guest only = yes
            of course you will have to edit this to your needs. (workgroup, share name, user name, printer name)

            Hope that helps
            HP Pavilion dv6 core i7 (Main)
            4 GB Ram
            Kubuntu 18.10

            Comment


              #7
              Re: Simple samba share for sharing files among Kubuntu and VirtualBox guest

              Originally posted by baucha
              I have already tried that trick few days back and again tried just now. It does ask for password when I click on "Configure file sharing" but the problem here is nothing happens after entering the password and pressing enter/ok. I had been wondering if the feature is not yet complete in KDE 4.x
              I don't deny the Dolphin right-click / Properties / Sharing is "what could be more intuitive". However, I was just normally expecting that the "run as admin" is available in the System Settings applet, where it isn't. Unless that's by design, my feeling is that something needs to be fixed there. At least many online docs refer to such admin mode for these settings.

              Regarding the right-click / Properties / Sharing, I too get asked for admin pwd, but after I enter it, nothing really happens, no new windows are opened. Perhaps I will go on with KDE update, maybe that will fix it, I'll report back to the forum.

              Comment


                #8
                Re: Simple samba share for sharing files among Kubuntu and VirtualBox guest

                Originally posted by Passiday
                Originally posted by baucha
                I have already tried that trick few days back and again tried just now. It does ask for password when I click on "Configure file sharing" but the problem here is nothing happens after entering the password and pressing enter/ok. I had been wondering if the feature is not yet complete in KDE 4.x
                I don't deny the Dolphin right-click / Properties / Sharing is "what could be more intuitive". However, I was just normally expecting that the "run as admin" is available in the System Settings applet, where it isn't. Unless that's by design, my feeling is that something needs to be fixed there. At least many online docs refer to such admin mode for these settings.

                Regarding the right-click / Properties / Sharing, I too get asked for admin pwd, but after I enter it, nothing really happens, no new windows are opened. Perhaps I will go on with KDE update, maybe that will fix it, I'll report back to the forum.
                And I'll try to test (I didn't click on the admin button myself, it was getting a bit late)

                Comment


                  #9
                  Re: Simple samba share for sharing files among Kubuntu and VirtualBox guest

                  Update: no change in the file sharing interface, when KDE 4.2.4 installed. Maybe there's a way how to spy what happens under the hood, when some KDE interface acts like that (ie, clicking a button does not result in opening a new window, etc.). Maybe somewhere internally an error is thrown, but no one reads it.

                  Comment


                    #10
                    Re: Simple samba share for sharing files among Kubuntu and VirtualBox guest

                    Yes, the way to do that is to start the programs from the command line (if you know the name). Some times the developers send lots of feedback to the standard output (the "terminal").

                    Comment


                      #11
                      Re: Simple samba share for sharing files among Kubuntu and VirtualBox guest

                      Samba requires some configuration before it will work. I don't run it myself but I do observe the same thing on my system when trying to share folders in KDE 4.2.4 without any configuration. I posted a simple guide on configuring Samba from an Ubuntu book I keep around on my Safari bookshelf. Most of it should apply to what you need to do.

                      Code:
                      On your server, install Samba itself plus some additional packages for
                      documentation, share browsing, and printer sharing:
                      
                      $ sudo apt-get install samba samba-doc libcupsys2-gnutls10 \\
                               libkrb53 winbind smbclient
                            
                      
                      
                      There are quite a few things to change in the default Samba config file, so open
                      /etc/samba/smb.conf in an editor and go through it to adjust the settings to
                      match the following example. Most of the example can be copied verbatim, but set
                      WORKGROUP to the name of the Windows domain (you can even leave it at WORKGROUP)
                      and set FILESERVER to the hostname of your Linux server:
                      
                      [global]
                        workgroup = WORKGROUP
                        netbios name = FILESERVER
                        server string = %h server (Samba, Ubuntu)
                      
                        passdb backend = tdbsam
                        security = user
                        username map = /etc/samba/smbusers
                        name resolve order = wins bcast hosts
                        domain logons = yes
                        preferred master = yes
                        wins support = yes
                      
                        ## Use CUPS for printing
                        printcap name = CUPS
                        printing = CUPS
                      
                        ## Set default logon
                        logon drive = H:
                        #logon script = scripts/logon.bat
                        logon path = \\\\fileserver\\profile\\%U
                      
                        ## User management scripts
                        add user script = /usr/sbin/useradd -m %u
                        delete user script = /usr/sbin/userdel -r %u
                        add group script = /usr/sbin/groupadd %g
                        delete group script = /usr/sbin/groupdel %g
                        add user to group script = /usr/sbin/usermod -G %g %u
                        add machine script = /usr/sbin/useradd -s /bin/false/ -d /var/lib/nobody %u
                        idmap uid = 15000-20000
                        idmap gid = 15000-20000
                      
                        ## Settings to sync Samba passwords with system passwords
                        passwd program = /usr/bin/passwd %u
                        passwd chat = *Enter\\snew\\sUNIX\\spassword:* %n\\n *Retype\\snew\\s 
                      
                      UNIX\\spassword:* %n\\n .
                        passwd chat debug = yes
                        unix password sync = yes
                      
                        ## Set the log verbosity level
                        log level = 3
                      
                      [homes]
                        comment = Home
                        valid users = %S
                        read only = no
                        browsable = no
                      
                      [printers]
                        comment = All Printers
                        path = /var/spool/samba
                        printable = yes
                        guest ok = yes
                        browsable = no
                      
                      [netlogon]
                        comment = Network Logon Service
                        path = /home/samba/netlogon
                        admin users = Administrator
                       valid users = %U
                        read only = no
                      
                      [profile]
                        comment = User profiles
                        path = /home/samba/profiles
                        valid users = %U
                        create mode = 0600
                        directory mode = 0700
                        writable = yes
                        browsable = no
                      
                      					 
                      
                      
                      The commented-out line that says:
                      
                        #logon script = scripts/logon.bat
                      
                      
                      defines a Windows batch script that will be executed by Windows workstations as
                      soon as a user logs in. This can be really handy if you want to apply standard
                      settings to all computers on your network; you may want to define server drive
                      mappings, set up printers, or configure a proxy server. If you have a logon.bat
                      script, uncomment that line.
                      
                      Create directories to store domain logons and profiles:
                      
                      $ sudo mkdir -p /home/samba/netlogon
                      $ sudo mkdir /home/samba/profiles
                      $ sudo mkdir /var/spool/samba
                      $ sudo chmod 777 /var/spool/samba/
                      $ sudo chown -R root:users /home/samba/
                      $ sudo chmod -R 771 /home/samba/
                            
                      
                      
                      Make sure Samba has seen your new configuration:
                      
                      $ sudo /etc/init.d/samba restart
                            
                      
                      
                      To enable WINS (Windows Internet Name Service) host resolution, edit
                      /etc/nsswitch.conf and look for a line similar to:
                      
                      hosts: files dns mdns
                      
                      
                      Change it to:
                      
                      hosts: files wins dns mdns
                      
                      
                      Since your file server is going to be the domain controller (DC) for your
                      Windows domain, you need to specify the computers that will be part of the
                      domain. Open /etc/hosts and add all the servers and workstations:
                      
                      192.168.0.10 server1
                      192.168.0.101 workstation1
                      192.168.0.102 workstation2
                      ...
                      192.168.0.107 workstation7
                      
                      
                      Windows typically has a special user named Administrator, which is akin to the
                      root user on Linux, so add the root user to the Samba password database and set
                      up an alias for it. This will allow you to use the Administrator username to add
                      new computers to the Windows domain:
                      
                      $ sudo smbpasswd -a root
                      $ sudo sh -c "echo 'root = Administrator' > /etc/samba/smbusers"
                            
                      
                      
                      To make sure everything has worked up to this point, use smbclient to query
                      Samba:
                      
                      $ smbclient -L localhost -U%
                            
                      
                      
                      The output will include details of several standard services, such as netlogon
                      and ADMIN, as well as the machines that have registered in the domain:
                      Code View: Scroll / Show All
                      
                      Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.21b]
                      
                          Sharename    Type   Comment
                          ---------  ----   -------
                          netlogon    Disk   Network Logon Service
                          IPC$      IPC    IPC Service (fileserver server (Samba,
                      Ubuntu))
                          ADMIN$     IPC    IPC Service (fileserver server (Samba,
                      Ubuntu))
                      Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.21b]
                      
                          Server        Comment
                          ---------      -------
                          FILESERVER      fileserver server (Samba, Ubuntu)
                      
                          Workgroup Master
                          ---------      -------
                          WORKGROUP      FILESERVER
                      
                      					 
                      
                      
                      Map some standard groups used in Windows domains to equivalent Linux groups:
                      
                      $ sudo net groupmap modify ntgroup="Domain Admins" unixgroup=root
                      $ sudo net groupmap modify ntgroup="Domain Users" unixgroup=users
                      $ sudo net groupmap modify ntgroup="Domain Guests" unixgroup=nogroup
                            
                      
                      
                      To allow users to authenticate in the domain, they need to be defined in the
                      domain controller. This process needs to be repeated for each user, but for now
                      just create one user to start with by first adding the Linux user and then
                      setting a password for that user in Samba. The user also needs to be placed in
                      the users group that was aliased to the Windows group Domain Users a moment ago:
                      
                      $ sudo useradd jon -m -G users
                      $ sudo smbpasswd -a jon
                            
                      
                      
                      That user should now be able to authenticate on workstations within your domain,
                      but there haven't yet been any shares added.
                      Add Shares
                      
                      Start by adding a simple share that all users can access. First, create the
                      directory that will become the share and set appropriate permissions on it:
                      
                      $ sudo mkdir -p /home/shares/public
                      $ sudo chown -R root:users /home/shares/public
                      $ sudo chmod -R ug+rwx,o+rx-w /home/shares/public
                            
                      
                      
                      Each share needs to be configured in Samba. Open /etc/samba/smb.conf and add a
                      new stanza at the end:
                      
                      [public]
                       comment = Public Share
                       path = /home/shares/public
                       valid users = @users
                       force group = users 
                       create mask = 0660
                       directory mask = 0771
                       writable = yes
                      
                      
                      Each time you modify the configuration, you need to restart Samba:
                      
                      $ sudo /etc/init.d/samba restart
                            
                      
                      
                      The preceding public stanza allows all users in the @users group to access the
                      share with full write privileges. This is probably not what you want in many
                      cases. For a share that can be accessed only by specific users, you can
                      substitute a line such as:
                      
                       valid users = jon,kyle,bill
                      
                      
                      To manage a large number of users, you can alternatively create another separate
                      group, set permissions on the share appropriately, and specify it in the share
                      definition. That way, you can add and remove users from that group without
                      having to reconfigure or restart Samba:
                      
                       valid users = @authors
                      
                      
                      You can also create read-only shares by setting the writable option to no:
                      
                       writable = no
                      
                      
                      Another typical scenario is a share that is read/write by some users but
                      read-only for others:
                      
                       valid users = @authors,@editors
                       read list = @authors
                       write list = @editors
                      linux &amp;&amp; bash = &quot;the future&quot;

                      Comment

                      Working...
                      X