Difference between revisions of "Setting up a samba-server"

From Alpine Linux
Jump to: navigation, search
(Create a share directory)
(remove `samba-common-tools` from Installation because package `samba` including `samba-common-tools`)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
= Installation =
 
= Installation =
 
Install packages:
 
Install packages:
{{Cmd|apk add samba samba-common-tools}}
+
{{Cmd|# apk add samba}}
  
 
= Create a share directory =
 
= Create a share directory =
 
This will be the directory that's shared to clients. You can create as many of these as you wish.
 
This will be the directory that's shared to clients. You can create as many of these as you wish.
{{Cmd|mkdir /media/storage}}
+
{{Cmd|# mkdir /media/storage}}
{{Cmd|chmod 0777 /media/storage}}
+
{{Cmd|# chmod 0777 /media/storage}}
  
 
= Create smb.conf =
 
= Create smb.conf =
Alpine doesn't provide an example configuration file in the package so you'll need to create one. If you have more than one share you'll need to add a subsection for each directory to '''smb.conf'''.
+
Alpine provides an example configuration file located at /etc/samba/smb.conf. The following is a simple example to get you up and running.
 
+
{{cat|/etc/samba/smb.conf|# /etc/samba/smb.conf
 +
<nowiki>
 
  [global]
 
  [global]
 
     workgroup = WORKGROUP
 
     workgroup = WORKGROUP
Line 21: Line 22:
 
     writeable = yes
 
     writeable = yes
 
     path = /media/storage
 
     path = /media/storage
 +
</nowiki>
 +
}}
 +
{{note|For each directory share, you'll need to add a subsection to '''smb.conf'''}}
  
 
= Create a system user and Samba user =
 
= Create a system user and Samba user =
 
Create a user on the system. Create a Samba user. Give both users the same password.
 
Create a user on the system. Create a Samba user. Give both users the same password.
{{Cmd|adduser username}}
+
{{Cmd|# adduser username}}
{{Cmd|smbpasswd -a username}}
+
{{Cmd|# smbpasswd -a username}}
  
 
= Configure the Samba service =
 
= Configure the Samba service =
 
Run these two commands to start the service on boot and to start the service right now.
 
Run these two commands to start the service on boot and to start the service right now.
{{Cmd|rc-update add samba}}
+
{{Cmd|# rc-update add samba}}
{{Cmd|rc-service samba start}}
+
{{Cmd|# rc-service samba start}}
 +
 
 +
[[Category:Server]]
 +
[[Category:Printers]]
 +
[[Category:Authentication]]

Latest revision as of 17:00, 15 December 2018

Installation

Install packages:

# apk add samba

Create a share directory

This will be the directory that's shared to clients. You can create as many of these as you wish.

# mkdir /media/storage

# chmod 0777 /media/storage

Create smb.conf

Alpine provides an example configuration file located at /etc/samba/smb.conf. The following is a simple example to get you up and running.

Contents of /etc/samba/smb.conf

# /etc/samba/smb.conf [global] workgroup = WORKGROUP dos charset = cp850 unix charset = ISO-8859-1 force user = username [storage] browseable = yes writeable = yes path = /media/storage
Note: For each directory share, you'll need to add a subsection to smb.conf

Create a system user and Samba user

Create a user on the system. Create a Samba user. Give both users the same password.

# adduser username

# smbpasswd -a username

Configure the Samba service

Run these two commands to start the service on boot and to start the service right now.

# rc-update add samba

# rc-service samba start