Zum Inhalt springen

Samba/Share: Unterschied zwischen den Versionen

Aus Foxwiki
K Textersetzung - „= Anwendungen =“ durch „= Anwendung =“
K Textersetzung - „ TCP“ durch „ TCP
 
(12 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
'''topic''' kurze Beschreibung
'''topic''' - Kurzbeschreibung
== Beschreibung ==
== Beschreibung ==
== Installation ==
== Installation ==
== Anwendung ==
== Anwendung ==
== Syntax ==
== Aufruf ==
=== Optionen ===
=== Optionen ===
=== Parameter ===
=== Argumente ===
=== Umgebungsvariablen ===
=== Umgebung ===
=== Exit-Status ===
=== Rückgabewert ===
== Konfiguration ==
== Konfiguration ==
=== Dateien ===
=== Dateien ===
Zeile 13: Zeile 13:
== Dokumentation ==
== Dokumentation ==
=== RFC ===
=== RFC ===
=== Man-Pages ===
=== Man-Page ===
=== Info-Pages ===
=== Info-Pages ===
== Siehe auch ==
== Siehe auch ==
Zeile 19: Zeile 19:
=== Projekt-Homepage ===
=== Projekt-Homepage ===
=== Weblinks ===
=== Weblinks ===
=== Einzelnachweise ===
<references />
== Testfragen ==
<div class="toccolours mw-collapsible mw-collapsed">
''Testfrage 1''
<div class="mw-collapsible-content">'''Antwort1'''</div>
</div>
<div class="toccolours mw-collapsible mw-collapsed">
''Testfrage 2''
<div class="mw-collapsible-content">'''Antwort2'''</div>
</div>
<div class="toccolours mw-collapsible mw-collapsed">
''Testfrage 3''
<div class="mw-collapsible-content">'''Antwort3'''</div>
</div>
<div class="toccolours mw-collapsible mw-collapsed">
''Testfrage 4''
<div class="mw-collapsible-content">'''Antwort4'''</div>
</div>
<div class="toccolours mw-collapsible mw-collapsed">
''Testfrage 5''
<div class="mw-collapsible-content">'''Antwort5'''</div>
</div>


[[Kategorie:Entwurf]]
 
 


= TMP =
= TMP =
Zeile 55: Zeile 33:
* It offers secured data transfer
* It offers secured data transfer
* Multichanel technology
* Multichanel technology
* Message signing-with digital signing users who receive the data packets are assured of the origin point authenticity.
* Message signing-with digital signing - users who receive the data packets are assured of the origin point authenticity.
* Allows concurrent operations.(simultaneous access to the files)
* Allows concurrent operations.(simultaneous access to the files)
* It offers good performance under heavy loads.
* It offers good performance under heavy loads.
* Samba supports POSIX extensions for CIFS/SMB
* Samba supports POSIX extensions for CIFS/SMB
* Supports NetBIOS over TCP/IP (NBT)
* Supports NetBIOS over [[TCP]]/IP (NBT)
* It supports the NT-style printing service (SPOOLSS)
* It supports the NT-style printing service (SPOOLSS)


Zeile 68: Zeile 46:
This guide will equip you with the required knowledge on how to configure Samba Share on Debian 11 / Debian 10.
This guide will equip you with the required knowledge on how to configure Samba Share on Debian 11 / Debian 10.


== Step 1 Install Samba on Debian 11 / Debian 10 ==
== Step 1 - Install Samba on Debian 11 / Debian 10 ==


We will start off by installing Samba on Debian 11 / Debian 10. This is easy since it is available in the default Debian repositories.{{anchor|ezoic-pub-ad-placeholder-167}} {{anchor|div-gpt-ad-computingforgeekscom-medrectangle-4-0}}  
We will start off by installing Samba on Debian 11 / Debian 10. This is easy since it is available in the default Debian repositories.{{anchor|ezoic-pub-ad-placeholder-167}} {{anchor|div-gpt-ad-computingforgeekscom-medrectangle-4-0}}  
Zeile 77: Zeile 55:


The following additional packages will be installed:
The following additional packages will be installed:
  attr ibverbs-providers keyutils libcephfs2 libgfapi0 libgfrpc0 libgfxdr0
attr ibverbs-providers keyutils libcephfs2 libgfapi0 libgfrpc0 libgfxdr0
  libglusterfs0 libibverbs1 librados2 librdmacm1 python3-cffi-backend
libglusterfs0 libibverbs1 librados2 librdmacm1 python3-cffi-backend
  python3-cryptography python3-dnspython python3-gpg python3-markdown
python3-cryptography python3-dnspython python3-gpg python3-markdown
  python3-pygments python3-requests-toolbelt python3-samba python3-tdb
python3-pygments python3-requests-toolbelt python3-samba python3-tdb
  python3-yaml samba-common samba-common-bin samba-dsdb-modules
python3-yaml samba-common samba-common-bin samba-dsdb-modules
  samba-vfs-modules tdb-tools
samba-vfs-modules tdb-tools
Suggested packages:
Suggested packages:
  winbind python-cryptography-doc python3-cryptography-vectors python3-sniffio
winbind python-cryptography-doc python3-cryptography-vectors python3-sniffio
  python3-trio python-markdown-doc python-pygments-doc ttf-bitstream-vera
python3-trio python-markdown-doc python-pygments-doc ttf-bitstream-vera
  bind9 bind9utils ctdb ldb-tools ntp | chrony smbldap-tools ufw
bind9 bind9utils ctdb ldb-tools ntp | chrony smbldap-tools ufw
  heimdal-clients
heimdal-clients
The following NEW packages will be installed:
The following NEW packages will be installed:
  attr cifs-utils ibverbs-providers keyutils libcephfs2 libgfapi0 libgfrpc0
attr cifs-utils ibverbs-providers keyutils libcephfs2 libgfapi0 libgfrpc0
  libgfxdr0 libglusterfs0 libibverbs1 librados2 librdmacm1
libgfxdr0 libglusterfs0 libibverbs1 librados2 librdmacm1
  python3-cffi-backend python3-cryptography python3-dnspython python3-gpg
python3-cffi-backend python3-cryptography python3-dnspython python3-gpg
  python3-markdown python3-pygments python3-requests-toolbelt python3-samba
python3-markdown python3-pygments python3-requests-toolbelt python3-samba
  python3-tdb python3-yaml samba samba-common samba-common-bin
python3-tdb python3-yaml samba samba-common samba-common-bin
  samba-dsdb-modules samba-vfs-modules smbclient tdb-tools
samba-dsdb-modules samba-vfs-modules smbclient tdb-tools
0 upgraded, 29 newly installed, 0 to remove and 0 not upgraded.
0 upgraded, 29 newly installed, 0 to remove and 0 not upgraded.
Need to get 24.4 MB of archives.
Need to get 24.4 MB of archives.
Zeile 100: Zeile 78:
Do you want to continue? [Y/n] y
Do you want to continue? [Y/n] y


== Step 2 Set the Samba Global settings ==
== Step 2 - Set the Samba Global settings ==


The Samba configuration file is located under '''''/etc/samba/smb.conf'''''. In this file, there are several changes we need to make. Although Debian is intelligent enough to provide default configurations, it is also good to verify this.
The Samba configuration file is located under '''''/etc/samba/smb.conf'''''. In this file, there are several changes we need to make. Although Debian is intelligent enough to provide default configurations, it is also good to verify this.
Zeile 112: Zeile 90:
workgroup = WORKGROUP
workgroup = WORKGROUP


== Step 3 Create Shared Samba Directory ==
== Step 3 - Create Shared Samba Directory ==


Here, you can share both public and private directories. So we will create the two directories as below.
Here, you can share both public and private directories. So we will create the two directories as below.
Zeile 126: Zeile 104:


[public]
[public]
  comment = Public Folder
  comment = Public Folder
  path = /public
  path = /public
  writable = yes
  writable = yes
  guest ok = yes
  guest ok = yes
  guest only = yes
  guest only = yes
  force create mode = 775
  force create mode = 775
  force directory mode = 775
  force directory mode = 775
[private]
[private]
  comment = Private Folder
  comment = Private Folder
  path = /private
  path = /private
  writable = yes
  writable = yes
  guest ok = no
  guest ok = no
  valid users = @smbshare
  valid users = @smbshare
  force create mode = 770
  force create mode = 770
  force directory mode = 770
  force directory mode = 770
  inherit permissions = yes
  inherit permissions = yes


== Step 4 Create Samba Share User and User Group ==
== Step 4 - Create Samba Share User and User Group ==


We need the Samba share user group to access the Private share as specified in the conf above. So we will create the group as below.
We need the Samba share user group to access the Private share as specified in the conf above. So we will create the group as below.
Zeile 177: Zeile 155:
sudo smbpasswd -e sambauser
sudo smbpasswd -e sambauser


== Step 5 Verify the Samba configuration ==
== Step 5 - Verify the Samba configuration ==


Once changes have been made to the config file, it is recommended that you test it using the below command:
Once changes have been made to the config file, it is recommended that you test it using the below command:
Zeile 194: Zeile 172:
<nowiki># Global parameters</nowiki>
<nowiki># Global parameters</nowiki>
[global]
[global]
        interfaces = 192.168.205.0/24 eth0
    interfaces = 192.168.205.0/24 eth0
        log file = /var/log/samba/log.%m
    log file = /var/log/samba/log.%m
        logging = file
    logging = file
        map to guest = Bad User
    map to guest = Bad User
        max log size = 1000
    max log size = 1000
        obey pam restrictions = Yes
    obey pam restrictions = Yes
        pam password change = Yes
    pam password change = Yes
        panic action = /usr/share/samba/panic-action %d
    panic action = /usr/share/samba/panic-action %d
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
    passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        passwd program = /usr/bin/passwd %u
    passwd program = /usr/bin/passwd %u
        server role = standalone server
    server role = standalone server
        unix password sync = Yes
    unix password sync = Yes
        usershare allow guests = Yes
    usershare allow guests = Yes
        idmap config * : backend = tdb
    idmap config * : backend = tdb
.....
.....
[public]
[public]
        comment = Public Folder
    comment = Public Folder
        force create mode = 0775
    force create mode = 0775
        force directory mode = 0775
    force directory mode = 0775
        guest ok = Yes
    guest ok = Yes
        guest only = Yes
    guest only = Yes
        path = /public
    path = /public
        read only = No
    read only = No




[private]
[private]
        comment = Private Folder
    comment = Private Folder
        force create mode = 0770
    force create mode = 0770
        force directory mode = 0770
    force directory mode = 0770
        inherit permissions = Yes
    inherit permissions = Yes
        path = /private
    path = /private
        read only = No
    read only = No
        valid users = @smbshare
    valid users = @smbshare


The above output shows that everything is configured appropriately. Now proceed as below.
The above output shows that everything is configured appropriately. Now proceed as below.
Zeile 243: Zeile 221:
sudo ufw allow from 192.168.205.0/24 to any app Samba
sudo ufw allow from 192.168.205.0/24 to any app Samba


== Step 6 Access the Shares from the Client. ==
== Step 6 - Access the Shares from the Client. ==


This guide demonstrates how to access the Share files using both Windows and Linux systems.
This guide demonstrates how to access the Share files using both Windows and Linux systems.
Zeile 253: Zeile 231:
Try "help" to get a list of possible commands.
Try "help" to get a list of possible commands.
smb: \> ls
smb: \> ls
  .                                   D       0 Tue Feb 8 01:31:42 2022
.                 D   0 Tue Feb 8 01:31:42 2022
  ..                                 D       0 Tue Feb 8 01:25:51 2022
..                 D   0 Tue Feb 8 01:25:51 2022
  demo1.txt                           N       0 Tue Feb 8 01:31:42 2022
demo1.txt             N   0 Tue Feb 8 01:31:42 2022
  demo-private                       D       0 Tue Feb 8 01:31:32 2022
demo-private           D   0 Tue Feb 8 01:31:32 2022


                39987708 blocks of size 1024. 32647972 blocks available
        39987708 blocks of size 1024. 32647972 blocks available
smb: \> exit
smb: \> exit



Aktuelle Version vom 4. Juli 2026, 11:49 Uhr

topic - Kurzbeschreibung

Beschreibung

Installation

Anwendung

Aufruf

Optionen

Argumente

Umgebung

Rückgabewert

Konfiguration

Dateien

Sicherheit

Dokumentation

RFC

Man-Page

Info-Pages

Siehe auch

Projekt-Homepage

TMP

How To Configure Samba Share on Debian 11 / Debian 10

Normally when you launch the system’s file manager on Linux/Windows system, you will see network shares advised on your network. These shares are only allowed if remote users are connected to the machine.

Samba is a free software that enables one to share files across the network using the SMB(Server Message Block) protocol. This tool was developed by Andrew Tridgell in December 1991 and January 1992.Vorlage:Anchor Vorlage:Anchor

The cool features associated with Samba are:* It is easy and quick to deploy

  • It offers secured data transfer
  • Multichanel technology
  • Message signing-with digital signing - users who receive the data packets are assured of the origin point authenticity.
  • Allows concurrent operations.(simultaneous access to the files)
  • It offers good performance under heavy loads.
  • Samba supports POSIX extensions for CIFS/SMB
  • Supports NetBIOS over TCP/IP (NBT)
  • It supports the NT-style printing service (SPOOLSS)


Samba is supported on various platforms such as Windows and Unix operating systems i.e Solaris, Linux, AIX, and BSD variants.Vorlage:Anchor Vorlage:Anchor

This guide will equip you with the required knowledge on how to configure Samba Share on Debian 11 / Debian 10.

Step 1 - Install Samba on Debian 11 / Debian 10

We will start off by installing Samba on Debian 11 / Debian 10. This is easy since it is available in the default Debian repositories.Vorlage:Anchor Vorlage:Anchor

sudo apt install samba smbclient cifs-utils

Dependency tree:

The following additional packages will be installed:

attr ibverbs-providers keyutils libcephfs2 libgfapi0 libgfrpc0 libgfxdr0
libglusterfs0 libibverbs1 librados2 librdmacm1 python3-cffi-backend
python3-cryptography python3-dnspython python3-gpg python3-markdown
python3-pygments python3-requests-toolbelt python3-samba python3-tdb
python3-yaml samba-common samba-common-bin samba-dsdb-modules
samba-vfs-modules tdb-tools

Suggested packages:

winbind python-cryptography-doc python3-cryptography-vectors python3-sniffio
python3-trio python-markdown-doc python-pygments-doc ttf-bitstream-vera
bind9 bind9utils ctdb ldb-tools ntp | chrony smbldap-tools ufw
heimdal-clients

The following NEW packages will be installed:

attr cifs-utils ibverbs-providers keyutils libcephfs2 libgfapi0 libgfrpc0
libgfxdr0 libglusterfs0 libibverbs1 librados2 librdmacm1
python3-cffi-backend python3-cryptography python3-dnspython python3-gpg
python3-markdown python3-pygments python3-requests-toolbelt python3-samba
python3-tdb python3-yaml samba samba-common samba-common-bin
samba-dsdb-modules samba-vfs-modules smbclient tdb-tools

0 upgraded, 29 newly installed, 0 to remove and 0 not upgraded. Need to get 24.4 MB of archives. After this operation, 84.7 MB of additional disk space will be used. Do you want to continue? [Y/n] y

Step 2 - Set the Samba Global settings

The Samba configuration file is located under /etc/samba/smb.conf. In this file, there are several changes we need to make. Although Debian is intelligent enough to provide default configurations, it is also good to verify this.

Open the file using a preferred editor.

sudo vim /etc/samba/smb.conf

In the file, make make adjustments as you deem fit, example for workgroup.

workgroup = WORKGROUP

Step 3 - Create Shared Samba Directory

Here, you can share both public and private directories. So we will create the two directories as below.

sudo mkdir /public sudo mkdir /private

Now edit the Samba conf and add the two directories.

sudo vim /etc/samba/smb.conf

At the end of the file, add the shares and authentication methods to access it.Vorlage:Anchor Vorlage:Anchor

[public]

 comment = Public Folder
 path = /public
 writable = yes
 guest ok = yes
 guest only = yes
 force create mode = 775
 force directory mode = 775

[private]

 comment = Private Folder
 path = /private
 writable = yes
 guest ok = no
 valid users = @smbshare
 force create mode = 770
 force directory mode = 770
 inherit permissions = yes

Step 4 - Create Samba Share User and User Group

We need the Samba share user group to access the Private share as specified in the conf above. So we will create the group as below.

sudo groupadd smbshare

Add the necessary permissions for the private share.

sudo chgrp -R smbshare /private/ sudo chgrp -R smbshare /public

Set the right directory permissions.

sudo chmod 2770 /private/ sudo chmod 2775 /public

In the above command, the value 2 at the beginning, stands for the SGID bit. This allows newly created files to inherit the parent group.

Next, create a no login local user to access the private share.

sudo useradd -M -s /sbin/nologin sambauser

Add the user to the Samba share group created above.

sudo usermod -aG smbshare sambauser

Now create an SMB password for the user.

sudo smbpasswd -a sambauser

Enable the created account:

sudo smbpasswd -e sambauser

Step 5 - Verify the Samba configuration

Once changes have been made to the config file, it is recommended that you test it using the below command:

sudo testparm

Execution output:

Load smb config files from /etc/samba/smb.conf Loaded services file OK. Weak crypto is allowed Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters [global]

   interfaces = 192.168.205.0/24 eth0
   log file = /var/log/samba/log.%m
   logging = file
   map to guest = Bad User
   max log size = 1000
   obey pam restrictions = Yes
   pam password change = Yes
   panic action = /usr/share/samba/panic-action %d
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
   passwd program = /usr/bin/passwd %u
   server role = standalone server
   unix password sync = Yes
   usershare allow guests = Yes
   idmap config * : backend = tdb

..... [public]

   comment = Public Folder
   force create mode = 0775
   force directory mode = 0775
   guest ok = Yes
   guest only = Yes
   path = /public
   read only = No


[private]

   comment = Private Folder
   force create mode = 0770
   force directory mode = 0770
   inherit permissions = Yes
   path = /private
   read only = No
   valid users = @smbshare

The above output shows that everything is configured appropriately. Now proceed as below.

Vorlage:Anchor Vorlage:Anchor Create demo files in the Samba shares:

sudo mkdir /private/demo-private /public/demo-public sudo touch /private/demo1.txt /public/demo2.txt

Restart the Samba service for the changes to apply.

sudo systemctl restart nmbd

If you have a firewall running, you need to allow remote access from the specified IP range:

sudo ufw allow from 192.168.205.0/24 to any app Samba

Step 6 - Access the Shares from the Client.

This guide demonstrates how to access the Share files using both Windows and Linux systems.

First, try accessing the share from your local machine.

Vorlage:Anchor Vorlage:Anchor $ smbclient '\\localhost\private' -U sambauser Enter WORKGROUP\sambauser's password: Try "help" to get a list of possible commands. smb: \> ls

.                  D    0 Tue Feb 8 01:31:42 2022
..                 D    0 Tue Feb 8 01:25:51 2022
demo1.txt              N    0 Tue Feb 8 01:31:42 2022
demo-private            D    0 Tue Feb 8 01:31:32 2022
       39987708 blocks of size 1024. 32647972 blocks available

smb: \> exit

Now proceed as set up clients.

1. Setup a Windows Client

To access the share from Windows, browse using the IP address of the Samba share system as below.

Vorlage:Anchor Vorlage:Anchor Open a run box using Win+R and proceed as shown.

"How To Configure Samba Share on Debian 11 Debian 10 1"

The shared folders should appear as below.

"How To Configure Samba Share on Debian 11 Debian 10 1 1"

Open one of the folders and create a file.

Vorlage:Anchor Vorlage:Anchor "How To Configure Samba Share on Debian 11 Debian 10 6"

The file should be visible on the Samba server machine.

"How To Configure Samba Share on Debian 11 Debian 10 7 1"

Now mount the Samba share permanently on your Windows system. Click on This PC->Map Network Drive

"How To Configure Samba Share on Debian 11 Debian 10 2"

Provide the Path details as below.

Vorlage:Anchor Vorlage:Anchor "How To Configure Samba Share on Debian 11 Debian 10 3"

Enter the Samba user credentials.

"How To Configure Samba Share on Debian 11 Debian 10 4"

You will have the share available as shown.

"How To Configure Samba Share on Debian 11 Debian 10 5"

2. Setup a Linux client

To set up a Linux client, you will need Samba packages:

sudo apt install samba-client cifs-utils

Once installed, navigate to File manager->Other locations and add your share using the syntax below.

smb://servername/Share_name

For example:

"How To Configure Samba Share on Debian 11 Debian 10 8"

Enter the credentials for the samba user.

"How To Configure Samba Share on Debian 11 Debian 10 9"

That is it! You have your Samba share as below.

Vorlage:Anchor Vorlage:Anchor "How To Configure Samba Share on Debian 11 Debian 10 10"

Voila!

I hope you enjoyed this guide on how to configure Samba Share on Debian 11 / Debian 10. Now you can easily share files over a network between Windows and Linux systems.

See more:* How To Share your Linux Terminal Session in Web Browser


https://computingforgeeks.com/how-to-configure-samba-share-on-debian/