Samba auf VM

Allgemeine Diskussionen über den Einsatz von VirtualBox.
rammi22
Posts: 26
Joined: 28. Jul 2017, 08:35

Samba auf VM

Post by rammi22 »

Hallo,

ich möchte von meinem Host auf Dateien im Guest via Samba zugreifen. Die Option von VBox "Gemeinsame Ordner" wird hierfür nicht benutzt.

Diese Dateien sind Bestandteil einer Webapplikation. Auf dem Host möchte ich diese Dateien bearbeiten, deshalb versuche ich diese mit Samba zu erreichen. Bislang habe ich nach verschiedenen Tutorials versucht Samba einzurichten:
Tutorial #1
Tutorial #2

Wenn ich versuche über Dieser PC -> Netzlaufwerk verbinden... Bekomme ich immer den Fehler:
Auf \\10.0.2.15\schooling konnte nicht zugegriffen werden.
...
Fehlercode 0x80070035
Der Netzwerkpfad wurde nicht gefunden
Mit net auf der Konsole kommt folgender Fehler

Code: Select all

C:\Users\ich>net use y: \\10.0.2.15\schooling
Systemfehler 53 aufgetreten.

Der Netzwerkpfad wurde nicht gefunden.
Mein System

Host
- Win10
- IP: 192.168.56.1

Guest
- Debian 9 stretch
- IP: 10.0.2.15
-- PHP7
-- Apache2
-- Samba version 4.5.12-Debian

NAT VM
-- IP: 10.0.2.2

Konfiguration Samba /etc/samba/smb.conf

Code: Select all

#======================= Global Settings =======================

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = WORKGROUP

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
#   wins support = no

# WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
;   wins server = w.x.y.z

# This will prevent nmbd to search for NetBIOS names through DNS.
   dns proxy = no

#### Networking ####

# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
;   interfaces = 127.0.0.0/8 eth0
   interfaces = 192.168.56.2

# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself.  However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
;   bind interfaces only = yes



#### Debugging/Accounting ####

# This tells Samba to use a separate log file for each machine
# that connects
   log file = /var/log/samba/log.%m

# Cap the size of the individual log files (in KiB).
   max log size = 1000

# If you want Samba to only log through syslog then set the following
# parameter to 'yes'.
#   syslog only = no

# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
   syslog = 0

# Do something sensible when Samba crashes: mail the admin a backtrace
   panic action = /usr/share/samba/panic-action %d


####### Authentication #######

# Server role. Defines in which mode Samba will operate. Possible
# values are "standalone server", "member server", "classic primary
# domain controller", "classic backup domain controller", "active
# directory domain controller". 
#
# Most people will want "standalone sever" or "member server".
# Running as "active directory domain controller" will require first
# running "samba-tool domain provision" to wipe databases and create a
# new domain.
   server role = standalone server

# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.  
   passdb backend = tdbsam

   obey pam restrictions = yes

# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
   unix password sync = yes

# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
# sending the correct chat script for the passwd program in Debian Sarge).
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
   pam password change = yes

# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
   map to guest = bad user

########## Domains ###########

#
# The following settings only takes effect if 'server role = primary
# classic domain controller', 'server role = backup domain controller'
# or 'domain logons' is set 
#

# It specifies the location of the user's
# profile directory from the client point of view) The following
# required a [profiles] share to be setup on the samba server (see
# below)
;   logon path = \\%N\profiles\%U
# Another common choice is storing the profile in the user's home directory
# (this is Samba's default)
#   logon path = \\%N\%U\profile

# The following setting only takes effect if 'domain logons' is set
# It specifies the location of a user's home directory (from the client
# point of view)
;   logon drive = H:
#   logon home = \\%N\%U

# The following setting only takes effect if 'domain logons' is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in 'DOS' file format convention
;   logon script = logon.cmd

# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe.  The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u

# This allows machine accounts to be created on the domain controller via the 
# SAMR RPC pipe.  
# The following assumes a "machines" group exists on the system
; add machine script  = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u

# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.  
; add group script = /usr/sbin/addgroup --force-badname %g

############ Misc ############

# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
;   include = /home/samba/etc/smb.conf.%m

# Some defaults for winbind (make sure you're not using the ranges
# for something else.)
;   idmap uid = 10000-20000
;   idmap gid = 10000-20000
;   template shell = /bin/bash

# Setup usershare options to enable non-root users to share folders
# with the net usershare command.

# Maximum number of usershare. 0 (default) means that usershare is disabled.
;   usershare max shares = 100

# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
   usershare allow guests = yes

#======================= Share Definitions =======================

[homes]
   comment = Home Directories
   browseable = no

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
   read only = yes

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
   create mask = 0700

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
   directory mask = 0700

# By default, \\server\username shares can be connected to by anyone
# with access to the samba server.
# The following parameter makes sure that only "username" can connect
# to \\server\username
# This might need tweaking when using external authentication schemes
   valid users = %S

# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
;   comment = Network Logon Service
;   path = /home/samba/netlogon
;   guest ok = yes
;   read only = yes

# Un-comment the following and create the profiles directory to store
# users profiles (see the "logon path" option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
;   comment = Users profiles
;   path = /home/samba/profiles
;   guest ok = no
;   browseable = no
;   create mask = 0600
;   directory mask = 0700

[schooling]
   comment = Freigabe Projekt Schooling
   path = /var/www/schooling
   guest ok = yes
   writeable = yes
   browseable = yes 

[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700

# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
;   write list = root, @lpadmin
Route zur index.php
/var/www/schooling/.../index.php
Warum klappt die Netzwerkverbindung zum Samba-Server nicht?
rammi22
Posts: 26
Joined: 28. Jul 2017, 08:35

Re: Samba auf VM

Post by rammi22 »

Niemand eine Idee, auch nicht wie ich da die Fehlersuche anfange?
towo2099
Volunteer
Posts: 362
Joined: 18. Aug 2014, 21:53
Primary OS: Debian Sid
VBox Version: PUEL
Guest OSses: Android, Linux

Re: Samba auf VM

Post by towo2099 »

Also ich würde die VM ja mit Bridged Networking betreiben.
Mit NAT mußt Du Portforwards für die SMB Ports einrichten und dieses Gefrickel würde ich mir nicht antun.
rammi22
Posts: 26
Joined: 28. Jul 2017, 08:35

Re: Samba auf VM

Post by rammi22 »

towo2099 wrote:Also ich würde die VM ja mit Bridged Networking betreiben.
Also einfach auf Adapter 1 "Netzwerkbrücke" einschalten?
Hab ich gemacht, dann passiert folgendes:

Code: Select all

C:\Users\ich>net use y: \\192.168.56.2\schooling
Systemfehler 53 aufgetreten.

Der Netzwerkpfad wurde nicht gefunden.

towo2099 wrote:Mit NAT mußt Du Portforwards für die SMB Ports einrichten ...
Ich würde mir das antun, wenn ich wüsste was genau wo zu machen ist. Habe mir das hier angeschaut und die Port-Weiterleitung entsprechend eingerichtet.
portforewarding_vbox.JPG
portforewarding_vbox.JPG (49.95 KiB) Viewed 7492 times
Ergebnis

Code: Select all

C:\Users\ich>net use y: \\192.168.56.2\schooling
Systemfehler 53 aufgetreten.

Der Netzwerkpfad wurde nicht gefunden.
Der Samba-Server läuft:
sambastatus.JPG
sambastatus.JPG (32.56 KiB) Viewed 7492 times
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Re: Samba auf VM

Post by stefan.becker »

Ebene tiefer starten: "ping 192.168.56.2" bringt welches Ergebnis bei Netzwerkbrücke?

Was bringt "ipconfig"? Ausgabe mal hier posten.
rammi22
Posts: 26
Joined: 28. Jul 2017, 08:35

Re: Samba auf VM

Post by rammi22 »

stefan.becker wrote:Ebene tiefer starten: "ping 192.168.56.2" bringt welches Ergebnis bei Netzwerkbrücke?

Was bringt "ipconfig"? Ausgabe mal hier posten.
Danke für die Antwort, ich probiere gerade noch ein weiteres Tut aus, ich geb dann Bescheid
rammi22
Posts: 26
Joined: 28. Jul 2017, 08:35

Re: Samba auf VM

Post by rammi22 »

Ich habe meine Samba Konfiguration in meiner VM nochmal mit diesem Tutorial nachgebaut. Ich kann mich immer noch nicht mit dem Samba-Server verbinden

Meine smb.conf

Code: Select all

[global]
   log file = /var/log/mysamba.log
   log level = 1
   workgroup = my.domain.de
   server string = Samba Server %v
   netbios name = debian
   security = user
   map to guest = bad user
   dns proxy = no
[homes]
   comment = Home Directories
   browseable = no
   valid users = %S
   writable = yes
   create mask = 0700
   directory mask = 0700
[anonymous]
   path = /home/shares/anonymous
   force group = users
   create mask = 0660
   directory mask = 0771
   browsable =yes
   writable = yes
   guest ok = yes
[allusers]
  comment = All Users
  path = /home/shares/allusers
  valid users = @users
  force group = users
  create mask = 0660
  directory mask = 0771
  writable = yes
Die Verzeichnisse sind vorhanden und die Rechte angepasst
ordner.JPG
ordner.JPG (21.95 KiB) Viewed 7465 times
auf dem Host (Win10) etc/hosts

Code: Select all

...
192.168.56.1	newsticker-mysqli.vbox.local newsticker
...

Rufe ich nun die IP im File-Explorer auf, bleibt der Ordner leer
explorer_empty_net.JPG
explorer_empty_net.JPG (31.38 KiB) Viewed 7465 times
Gebe ich anstatt die IP "\\newsticker\tom" ein, werde ich nach einem Passwort gefragt und nach Eingabe wird mir ein falsches Passwort gemeldet
passwd_failed.JPG
passwd_failed.JPG (58.72 KiB) Viewed 7465 times
stefan.becker wrote:...Was bringt "ipconfig"? Ausgabe mal hier posten.
Gerne

Code: Select all

C:\Users\ich>ipconfig

Windows-IP-Konfiguration


Ethernet-Adapter LAN-Verbindung:

   Verbindungsspezifisches DNS-Suffix: xxx.de
   Verbindungslokale IPv6-Adresse  . : fe80::41d4:c931:670:fb22%8
   IPv4-Adresse  . . . . . . . . . . : 10.0.60.64
   Subnetzmaske  . . . . . . . . . . : 255.255.0.0
   Standardgateway . . . . . . . . . : 10.0.0.2

Ethernet-Adapter VirtualBox Host-Only Network:

   Verbindungsspezifisches DNS-Suffix:
   Verbindungslokale IPv6-Adresse  . : fe80::a92e:d6a6:eb5a:5a9c%17
   IPv4-Adresse  . . . . . . . . . . : 192.168.56.1
   Subnetzmaske  . . . . . . . . . . : 255.255.255.0
   Standardgateway . . . . . . . . . : 192.168.56.2

Tunneladapter isatap.{F9409FBF-9B2C-4868-A701-EBDE357FA276}:

   Medienstatus. . . . . . . . . . . : Medium getrennt
   Verbindungsspezifisches DNS-Suffix:

Tunneladapter isatap.xxx.de:

   Medienstatus. . . . . . . . . . . : Medium getrennt
   Verbindungsspezifisches DNS-Suffix: xxx.de
Und auch gleich nochmal die Linux-Seite
#### im nächsten post, da nur 3 bilder möglich ####

Ich hoffe das hilft weiter?!
rammi22
Posts: 26
Joined: 28. Jul 2017, 08:35

Re: Samba auf VM

Post by rammi22 »

rammi22 wrote:...
Und auch gleich nochmal die Linux-Seite
#### im nächsten post, da nur 3 bilder möglich ####

Ich hoffe das hilft weiter?!
ip.JPG
ip.JPG (56.03 KiB) Viewed 7464 times
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Re: Samba auf VM

Post by stefan.becker »

Stelle das mal ein auf Bridged.

Dann ein ipconfig vom Gast und im Gast einen Ping auf die IP-Adresses des Hostes.

Das sollte doch klappen.
rammi22
Posts: 26
Joined: 28. Jul 2017, 08:35

Re: Samba auf VM

Post by rammi22 »

stefan.becker wrote:Stelle das mal ein auf Bridged.

Dann ein ipconfig vom Gast und im Gast einen Ping auf die IP-Adresses des Hostes.

Auf Netzwerkbrücke umgestellt
bridget.JPG
bridget.JPG (24.68 KiB) Viewed 7443 times
ifconfig vom Guest
ifconfig.JPG
ifconfig.JPG (61.1 KiB) Viewed 7443 times
ping Guest -> Host
ping_guest_to_host.JPG
ping_guest_to_host.JPG (16.03 KiB) Viewed 7443 times
stefan.becker wrote:Das sollte doch klappen.
Leider nicht...

Weitere Tipps?
Martin
Volunteer
Posts: 2561
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: Samba auf VM

Post by Martin »

Bist Du Dir sicher, daß der Netzwerkadapter im Gast DHCP aktiv hat? Laut der Ausgabe hat er keine IPv4 Adresse und kann somit auch nicht am Netzwerk teilnehmen.
rammi22
Posts: 26
Joined: 28. Jul 2017, 08:35

Re: Samba auf VM

Post by rammi22 »

Martin wrote:Bist Du Dir sicher, daß der Netzwerkadapter im Gast DHCP aktiv hat? Laut der Ausgabe hat er keine IPv4 Adresse und kann somit auch nicht am Netzwerk teilnehmen.
Das ist eine andere Einstellung. Aber ich habe es umgestellt
nat_bridget_enabled.JPG
nat_bridget_enabled.JPG (36.95 KiB) Viewed 7440 times
ping von Guest
ping_guest_to_host1.JPG
ping_guest_to_host1.JPG (43.86 KiB) Viewed 7440 times
und die ifconfig
ifconfig1.JPG
ifconfig1.JPG (61.04 KiB) Viewed 7440 times
Also der ping geht offensichtlich mit der Einstellung NAT-Netzwerk, aber nach wie vor komm ich nicht an den Server

Code: Select all

C:\Users\ich>net use * "\\192.168.56.1\allusers" meinPasswort /user:mein.name /persistent:no
Systemfehler 67 aufgetreten.

Der Netzwerkname wurde nicht gefunden.


C:\Users\ich>net use * "\\newsticker\allusers" meinPasswort /user:mein.name /persistent:no
Systemfehler 86 aufgetreten.

Das angegebene Netzwerkkennwort ist falsch.
Martin
Volunteer
Posts: 2561
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: Samba auf VM

Post by Martin »

NAT erlaubt (ohne komplexere Port-forwarding Konfigurationen) nur Verbindungen vom Gast zum Host, keine vom Host zum Gast.
Bei bridged networking muß eventuell die IP Konfiguration manuell im Gast vorgenommen werden.
rammi22
Posts: 26
Joined: 28. Jul 2017, 08:35

Re: Samba auf VM

Post by rammi22 »

Danke schonmal für deine Hilfe
Martin wrote:Nat erlaubt ... *mit* komplexere Port-forwarding Konfigurationen ...
Hast du zu diesem Thema eventuell mehr Infos, Links etc?
Martin wrote:Bei bridged networking muß eventuell die IP Konfiguration manuell im Gast vorgenommen werden.
Das wäre dann Einstellung "Netzwerkbrücke"? Es wäre nett, wenn du auch hierzu weiterführende Infos bereitstellen könntest, welche IP's und in welchen Dateien. Auch Links nehme ich gern an.
Martin
Volunteer
Posts: 2561
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: Samba auf VM

Post by Martin »

Mit "Netzwerkbrücke" benimmt sich Deine VM wie ein PC der per Kabel im lokalen Netzwerk angeschlossen ist. Damit musst Du dann das Netzwerk in der VM dementsprechend konfigurieren.
Post Reply