Create Home NAS Server – Ubuntu/Debian

Exported on 22-Sep-2021 14:34:21

Install Home NAS Server (Samba Server) On Debian With AttuneOps

This Blueprint Installs Samba Server On A Debian Based Linux System.

Samba is an implementation of the SMB/CIFS protocol for Unix systems, providing support for cross-platform file sharing with Microsoft Windows, OS X, and other Unix systems. Samba can also function as an NT4-style domain controller, or join a Windows Active Directory domain.

It works like this: The clients send their NetBIOS names & IP addresses to the NBNS server, which keeps the information in a simple database. When a client wants to talk to another client, it sends the other client's name to the NBNS server.

Pre-Blueprint Attune setup
  1. On the Inputs tab, create a Linux node for the host you wish to install the stack on.
  2. On the Inputs tab, create Linux credentials to connect to the host you wish to install the stack on.
Steps Involved
  • Update APT repositories.
  • Install Samba Server.
  • Protect the Samba server with a password and launch it.

Parameters

Name Type Script Reference Default Value Comment
Linux Node Linux / Unix Server linuxNode
Linux User Linux OS Credential linuxUser

1 - Update APT Repositories

Update APT repositories

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Update apt repositories
sudo apt update

2 - Install Samba Server

Install Samba Server

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Install Samba
sudo apt -y install samba

3 - Upload password file

Upload password file, contains password to be set for the Samba client.

Login as user on node

Connect via SSH
ssh user@hostname
Deploy archive password.txt.zip to remote path uploads
  1. Locate Files archive "password.txt.zip", This can be downloaded from Attune
  2. Copy the Files archive to the server
  3. Extract the root of the Files archive to uploads, relative to the home directory
  4. Check that the files are in the correct location

4 - Configure Samba Server

Configure samba share server for the current user

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
mkdir ~/sambashare/

export LOCAL_USER_NAME=$(whoami)

sudo echo "[sambashare]
    comment = Samba on Ubuntu
    path = /home/"$LOCAL_USER_NAME"/sambashare
    read only = no
    browsable = yes" >> sudo tee -a /etc/samba/smb.conf
    
#Set password 
cat uploads/password.txt | sudo smbpasswd -a $LOCAL_USER_NAME

5 - Restart Samba Server

Restarts Samba Server.

Once this is complete you can use a File manager to connect to the Samba file server with the endpoint: smb://your_ip/sambashare

Reference: https://ubuntu.com/tutorials/install-and-configure-samba#4-setting-up-user-accounts-and-connecting-to-share

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Restart samba server
sudo service smbd restart