Samba is the standard Windows interoperability suite of programs for Linux and Unix. It enables file sharing across different operating systems over a network.
Prepare the hard drive (sdb1, let’s suppose a second hard drive). We can find its UUID (UUID stands for Universally Unique Identifier) by typing: ls -la /dev/disk/by-uuid […] root root 10 Mar 28 04:23 ece31d22-201d-4421-b540-4337b029d72f -> ../../sdb1.
Let’s edit fstab: sudo vi /etc/fstab and add a line like this:
UUID=ece31d22-201d-4421-b540-4337b029d72f (device or filesystem to be mounted) /media/mydisk (mount point for the filesystem) ext4 (it describes the type of the filesystem) nofail,auto (options: nofail, do not report errors for this device if it does not exist; auto, the filesystem can be mounted automatically)0(dump option. It is seldom used so if you are in doubt, just use 0)0(disable checking the file system at boot).
sudo mount -a: it causes all filesystems mentioned in fstab to be mounted as indicated.
[pi]# Each section in the configuration file describes a shared resourcepath= /media/mydisk/samba # This is the shared resource's path comment= My Samba Share # Comment string to be associate with the new shared resource browseable= yes # The resource is seen in the list of available shares in a net view and in the browse list readonly= no # read only = no, and writable = yes allow all users to access and write create mask=0700 directory mask=0700writable= yes
valid users= nmaximo7 # It restricts access to specific users8. Create a user group: _sudo groupadd -r sambausers_
Add my user (nmaximo7) to this group (sudo usermod -aG sambausers nmaximo7) and add a password to my user to use this service: sudo smbpasswd -a nmaximo7. Note: Samba uses a password separate from that of the Linux user accounts.
Change the ownership and permissions of the samba directory: sudo chown -R root:sambausers /media/mydisk/samba, sudo chmod 1770 /media/mydisk/samba
Restart the samba service (Pi): sudo service smbd restart. Enabling and starting services (Arch): sudo systemctl enable ‐‐now smb, sudo systemctl enable ‐‐now nmb
On the client computer, access the shared folder from your file manager. If you are using Windows, open File Explorer and click Network on the left pane. If you are using GNU/Linux, open Nautilus, Other Locations, connect to server, and type smb://IP’s Samba Server.
Webtop is a lightweight Linux-based container with a full desktop environment running in a browser.
First, let’s create a folder in the home directory (mkdir webtop), go inside it, and create a folder (mkdir config) and a docker-compose.yml file (touch docker-compose.yml, vim docker-compose.yml)
Let’s see the content of our docker-compose.yml
image: lscr.io/linuxserver/webtop:ubuntu-mate # The image provides various versions that are available via tags, e.g., latest (XFCE Alpine), ubuntu-mate (MATE Ubuntu), arch-i3 (i3 Arch), etc.
- seccomp:unconfined #optional
- PUID=1000 # User PUID, just type in the terminal: id
- PGID=1000 # Group PGID
- TZ=Europe/Madrid # It sets the timezone for your location.
- KEYBOARD=es-es-qwerty # Spanish keyboard
- /home/pi/webtop/config:/config # This is the bridge between the path for your data storage on your host container (/home/pi/webtop/config)/to the home directory in the Linux-based container running in the browser
- 3000:3000 # -p <external>:<internal>, it exposes the (internal) port 3000 to be accesible from the host's IP on (external) port 3000 outside the container.
- /dev/dri:/dev/dri #optional
shm_size: "2gb" # This is the memory limit.
privileged: true # The KDE and i3 flavors for Ubuntu need to be run in privileged mode.
Next, we need to run the docker-compose.yml file: docker-compose up -d (d is for detached mode).
Launch your favorite browser and type:
http://[PI_ADDRESS]:3000 # If you don't remember your PI's IP address, type: hostname -I. By default, the user and password is abc/abc.
Nextcloud. It could be seen as a safe home for all your data, a self-hosted productivity platform or your own Dropbox/Google Drive.
Let’s install it with Docker. First, we pull an image of Nextcloud: docker pull nextcloud.
Run your image as a container and start Nextcloud: docker run ‐‐name nextcloud -d -p 8080:80 nextcloud.
Container images are configured using parameters passed at runtime: -p 8080:80 would expose port 80 from inside the container to be accessible from the host’s IP on port 8080 outside the container. -d is the detached mode: run the container in the background and print the new container ID. ‐‐name nextcloud: Assign the name “nextcloud” to the container.
Using a browser navigate to https://ip-address:8080 (Remember: -p 8080:80) and start the Nextcloud setup screen. It uses SQLite by default. SQLite is an open-source, self-contained database engine designed to be embedded into an application, but it is not recommended, so we are going to use PostgreSQL instead of SQLite.
We need to stop our running container: docker stop nextcloud (Remember: ‐‐name nextcloud). Next, we remove the container: docker rm nextcloud.
Let’s pull an image of PostgreSQL (a free and open-source relational database management system): docker pull postgres.
Next, we need to create a Docker network. It allows containers connected to the same bridge network to communicate, while providing isolation from containers which are not connected to that bridge network. Create a user-defined bridge network: docker network create ‐‐driver bridge nextcloud-net. ‐‐driver bridge is the default network driver. Bridge networks are usually used when your applications run in standalone containers that need to communicate. nextcloud-net would be the docker network’s name.
Start the PostgreSQL container in the docker network: docker run ‐‐name postgres -e POSTGRES_PASSWORD=mysecretpassword ‐‐network nextcloud-net -d postgres (default user: postgres, POSTGRES_PASSWORD sets the superuser password for PostgreSQL: mysecretpassword).
Start the Nextcloud container in the docker network: docker run ‐‐name nextcloud -d -p 8080:80 -v /home/pi/nextcloud:/var/www/html ‐‐network nextcloud-net nextcloud. -v /home/pi/nextcloud:/var/www/html: /var/www/html is the folder where all Nextcloud data lives, /home/pi/nextcloud is our “mounted” host directory in the docker container.
Using a browser navigate to https://ip-address:8080. Create an admin Account. Configure the database: Switch the database type to PostgreSQl and type the credentials: Database user (postgres), Database password (mysecretpassword), Database name (postgres), change localhost to postgres (the name of the container).
Install client apps to sync your files (Desktop, Android or iOS). Download, install, and login (Server address: https//dirIPRaspberryPi). Install some apps so you can add all sorts of functionality to your Nextcloud server: OnlyOffice (real-time document editing and collaborative capabilities), News (a RSS/Atom feed reader), Passwords (a Password Manager), Music, AppOrder, etc.
NFS (Network File System) allows a user on a client computer to access files over a network in the same way they would access a local storage file.
Install the nfs-kernel-server package: sudo apt install nfs-kernel-server. NFS will translate any root operations on the client to the nobody:nogroup credentials: sudo chown -R nobody:nogroup /mnt/discoExterno/nfsShare/ where nfsShare is the folder that we want to share.
Configure the NFS configuration file: sudo vi /etc/exports:
The syntax is as follows: Directory_to_share (/mnt/discoExterno/nfsShare) client (192.168.1.0/255.255.255.0, the private network) options (rw: It gives the client computer both read and write access; sync: It forces NFS to write changes to disk before replying; insecure, all_squash, anonuid=1000, anongid=1000: macOS specific).
Restart the NFS server: sudo systemctl restart nfs-kernel-server.
Allow NFS Access through the Firewall: sudo ufw allow from 192.168.1.0/24 to any port nfs
Client (macOS). Is the resource available in the NFS server? showmount -e 192.168.1.48 (192.168.1.48 is the NFS server’s IP). In Finder, press cmd + k and enter the path to the NFS server/share: