Setting up a Samba server: Difference between revisions

From Alpine Linux
No edit summary
 
(4 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 =
Line 12: Line 12:
{{cat|/etc/samba/smb.conf|# /etc/samba/smb.conf
{{cat|/etc/samba/smb.conf|# /etc/samba/smb.conf
<nowiki>
<nowiki>
[global]
[global]
    workgroup = WORKGROUP
#to allow symlinks from everywhere
    dos charset = cp850
allow insecure wide links = yes
    unix charset = ISO-8859-1
workgroup = WORKGROUP
    force user = username
dos charset = cp866
unix charset = utf-8
[storage]
force user = username
    browseable = yes
 
    writeable = yes
[storage]
    path = /media/storage
# to follow symlinks
follow symlinks = yes 
# to allow symlinks from outside
wide links = yes     
browseable = yes
writeable = yes
path = /media/storage
</nowiki>
</nowiki>
}}
}}

Latest revision as of 06:45, 30 May 2023

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] #to allow symlinks from everywhere allow insecure wide links = yes workgroup = WORKGROUP dos charset = cp866 unix charset = utf-8 force user = username [storage] # to follow symlinks follow symlinks = yes # to allow symlinks from outside wide links = yes 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