Differences between revisions 1 and 20 (spanning 19 versions)
Revision 1 as of 2013-12-02 04:20:20
Size: 1408
Editor: ?JacquesDeBroin
Comment:
Revision 20 as of 2021-01-18 02:37:06
Size: 2805
Editor: PaulWise
Comment: typos, don't dictate which editor to use
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from SambaServerSimple
Line 2: Line 3:
~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: none-~ ~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: English - [[zh_CN/SambaServerSimple|简体中文]] ~
Line 4: Line 5:
This is a minimal Samba setup to let other machines access files on your Debian machine.
Line 6: Line 6:
## If your page gets really long, uncomment this Table of Contents
## <<TableOfContents(2)>>
= Samba file sharing server =
Line 9: Line 8:
== Title 1 ==
Simple Samba Server setup
This is a minimal Samba setup to let other machines access files on a Debian machine.
Line 12: Line 10:
=== Install Samba === === Installation and configuration ===

 * [[PackageManagement#Installing.2C_removing.2C_upgrading_software|Install]] the DebianPkg:samba and DebianPkg:samba-client packages
 * Configure the Samba server by editing the configuration file `/etc/samba/smb.conf`

In the `[global]` section, set the name of the `workgroup`. You will need to specify the workgroup name when connecting from a Windows machine.
Line 14: Line 18:
# aptitude install samba [global]
   ...
   workgroup = EXAMPLE
Line 17: Line 23:
== Configure the Samba daemon ==
Edit the Samba configuration file.
{{{
# vim /etc/samba/smb.conf

{{{#!wiki note
page cleanup/reorganization in progress below this point
Line 22: Line 27:

=== Sharing home directories ===
Line 37: Line 44:
   locking = no
Line 42: Line 48:
== Add Samba users ==
Samba uses it's own password system so users need to be added by root.
See smb.conf man page for details.

=
== Add Samba users ===
Samba uses it's own password system so users need to be added by root. Note that the users have to exist in /etc/passwd
Line 45: Line 53:
sudo smbpasswd -a me
sudo smbpasswd -a you
# smbpasswd -a me
# smbpasswd -a you
Line 48: Line 56:
You will be prompted for a password. You will be prompted for a password for each of those users.
Line 50: Line 58:
== Restart the Samba daemon == To list existing Samba users:
Line 52: Line 60:
sudo /etc/init.d/samba restart pdbedit -w -L
Line 55: Line 63:

== Try to access the shares locally ==
My share:
=== Restart the Samba daemon ===
Line 59: Line 65:
smbclient //ourmachine/me # /etc/init.d/samba restart
}}}
or, if you are using systemd
{{{
# /usr/sbin/service smbd restart
Line 62: Line 72:
Your share: == Add firewall rules ==
Allow access from machines in the local LAN:
Line 64: Line 75:
smbclient -U you //ourmachine/you iptables -A INPUT -p udp --dport 137 -s 192.168.1.0/24 -m state --state NEW -j ACCEPT
iptables -A INPUT -p udp --dport 138 -s 192.168.1.0/24 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 139 -s 192.168.1.0/24 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 445 -s 192.168.1.0/24 -m state --state NEW -j ACCEPT
Line 67: Line 81:
Our share: === Try to access the shares (as a normal user) ===
Try locally first, then from another machine on the network which also installed samba client.
When prompted, use the password entered when adding the user to Samba.

To access my share:
Line 69: Line 87:
smbclient //ourmachine/ourfiles $ smbclient //ourmachine/me
}}}

To access your share:
{{{
$ smbclient -U you //ourmachine/you
}}}

To access our shared(!) share:
{{{
$ smbclient //ourmachine/ourfiles
Line 76: Line 104:
Network
CategoryNetwork | CategorySoftware | CategoryObsolete | CategorySystemAdministration | ToDo: group with other [[Samba]] pages

Translation(s): English - 简体中文 ~


Samba file sharing server

This is a minimal Samba setup to let other machines access files on a Debian machine.

Installation and configuration

  • Install the samba and samba-client packages

  • Configure the Samba server by editing the configuration file /etc/samba/smb.conf

In the [global] section, set the name of the workgroup. You will need to specify the workgroup name when connecting from a Windows machine.

[global]
   ...
   workgroup = EXAMPLE

page cleanup/reorganization in progress below this point

Sharing home directories

Locate the home share definition:

[homes]

In that section you may enable read-write access to the home directories:

   read only = no

To share files in some other path on the system, add another share definition such as:

[ourfiles]
   comment = Some useful files
   read only = no
   path = /path_to_our_files
   guest ok = no

See smb.conf man page for details.

Add Samba users

Samba uses it's own password system so users need to be added by root. Note that the users have to exist in /etc/passwd

# smbpasswd -a me
# smbpasswd -a you

You will be prompted for a password for each of those users.

To list existing Samba users:

pdbedit -w -L

Restart the Samba daemon

# /etc/init.d/samba restart

or, if you are using systemd

# /usr/sbin/service smbd restart

Add firewall rules

Allow access from machines in the local LAN:

iptables -A INPUT -p udp --dport 137 -s 192.168.1.0/24 -m state --state NEW -j ACCEPT
iptables -A INPUT -p udp --dport 138 -s 192.168.1.0/24 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 139 -s 192.168.1.0/24 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 445 -s 192.168.1.0/24 -m state --state NEW -j ACCEPT

Try to access the shares (as a normal user)

Try locally first, then from another machine on the network which also installed samba client. When prompted, use the password entered when adding the user to Samba.

To access my share:

$ smbclient //ourmachine/me

To access your share:

$ smbclient -U you //ourmachine/you

To access our shared(!) share:

$ smbclient //ourmachine/ourfiles

See also

SAMBAClientSetup


CategoryNetwork | CategorySoftware | CategoryObsolete | CategorySystemAdministration | ToDo: group with other Samba pages