Repository navigation
Turris LXC setup
This page describes the setup of my Turris containers. It just describes the necessary steps to get the container with the desired services (Samba, DLNA server, git backup engine) up and running.
passwdecho CONTAINER-NAME > /etc/hostnamewhere CONTAINER-NAME is the name of the container.
Note: setting the hostname only by running hostname CONTAINER-NAME is not enough as it's effective only to the next reboot.
dpkg-reconfigure tzdataSelect Europe -> Prague. The current timezone is set by the /etc/localtime symlink.
cat $(readlink -f /etc/localtime)apt-get install man mc screen openssh-serverScp your public key to the container's /root and add it to authorized_keys. The .ssh directory doesn't exist yet, the simplest way to create it (with the right permissions) is to create keys for root:
ssh-keygen -C "root@CONTAINER-NAME (on Turris)"
cat id_rsa.pub >> .ssh/authorized_keysDisable container's root authentication by password. Edit /etc/ssh/sshd_config and change the PermitRootLogin option to without-password and restart the service.
/etc/init.d/sshd restartSamba will be set up so that it requires authentication, but the main share is storing files as nobody:nogroup.
apt-get install sambaThe config file contains only items that are not default per smb.conf man page.
man smb.confThe main config is at /etc/samba/smb.conf.
Backup this config first:
cp /etc/samba/smb.conf /etc/samba/smb.conf.origThen replace the config with the content below. Only options with non-default values are set.
[global]
netbios name = servicebox
workgroup = WORKGROUP
server string = Turris Omnia
log file = /var/log/samba/%m.log
log level = 3
[share]
path = /srv/samba/share
read only = no
create mask = 644
directory mask = 775
force user = nobody
force group = nogroupRestart the samba server to apply tyhe changes:
/etc/init.d/samba restartCreate the share corresponding to the path option in the [share] section above and set its ownership to nobody:nogroup. In case an attempt to write a file from the mounted Samba share on Windows fails, the problem is usually with the share permissions on the filesystem.
mkdir -p /srv/samba/share
chown nobody:nogroup /srv/samba/shareEvery Samba user has to have a corresponding system user account. These accounts don't have to have homes or shells set though.
useradd -M -s /bin/false USER
smbpasswd -a USERThis will create user USER without home directory (-M option) and with /bin/false used as shell. The users don't have password set by default (see the exclamation mark in the password filed of /etc/shadow).
The smbpasswd then creates the corresponding Samba user in the default database, which is stored at /var/lib/samba/private/passdb.tdb.
To list users, use
pdbedit -L -vThe setup of minidlna is pretty simple. Just install it and configure the location of the data. Unfortunately, it's not possible (as of Feb 2019) to update the icon of the DLNA server without recompiling it from sources.
apt-get install minidlnaThe config is located at /etc/minidlna.conf.
The parameter that needs to be updated is the notify interval that determines how often the DLNA server advertises itself over the network.
# SSDP notify interval, in seconds.
notify_interval=60To set up log levels for various subsystems, set
log_level=general=debug,artwork=warn,database=debug,inotify=debug,scanner=debug,metadata=debug,http=warn,ssdp=warn,tivo=warnIf systemd service definition is missing at /etc/systemd/system/minidlna.service, it can be defined (to prevent redirection to /etc/init.d scripts as
[Unit]
Description=MiniDLNA is a DLNA/UPnP-AV server software
After=syslog.target local-fs.target network.target
[Service]
User=minidlna
Group=minidlna
Type=forking
ExecStart=/usr/sbin/minidlnad -f /etc/minidlna.conf
[Install]
WantedBy=multi-user.targetIn case the minidlna service doesn't start and there is no etry in the log file, verify that the directory where the case is located (usually /var/cache/minidlna) exists and is owned by minidlna:minidlna.