2918
Comment: add external link
|
2850
modernise: init.d -> service
|
Deletions are marked like this. | Additions are marked like this. |
Line 63: | Line 63: |
=== Restart the Samba daemon === | === Restart the Samba file sharing daemon === |
Line 65: | Line 65: |
# /etc/init.d/samba restart }}} or, if you are using systemd {{{ # /usr/sbin/service smbd restart |
# service smbd restart |
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 file sharing daemon
# 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
CategoryNetwork | CategorySoftware | CategoryObsolete | CategorySystemAdministration | ToDo: group with other Samba pages