Desktop integration for my NAS.
This is in no way intended to be generic. The project is public only because it contains no sensitive information and makes cloning easier.
The following are required by default, unless option --no-gui is provided:
- host
nasis defined on the machine - python 3 installed with
gi,PyGObjectandGTK 3.0sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0 - Python 3 package
SecretStorage(already installed on Ubuntu?)
The following are required to mount NAS drives on Linux
- package
cifs-utilsinstalled-
sudo apt-get install cifs-utils -
directory
/__NAS__must existsudo mkdir /mnt/__NAS__ && sudo chmod o+wx /mnt/__NAS__
-
- an authentication file
{clone_directory}/.smb_phanasexists, with 600 permission and the following content:username=XXXX password=YYYY - sudoers is configured to allow
mountandumountof the drives without authentication- use script to configure sudo:
configure_sudoers.sh - the script uses
phanas_desktop.py --generate-sudoersunder the hood to produce the required sudoers configuration for the current Linux user - if sudoers was previously configure manually, manually remove the configuration with:
sudo EDITOR=vim visudo
- use script to configure sudo:
The following are required to synchronize remote keyfiles stored on NAS with a local copy:
- host
nasis defined on the machine - KeePassXC
- snap package is most up to date:
snap install keepassxc
- snap package is most up to date:
Add phanas_desktop.py to Gnome's startup programs:
ALT+F2, inputgnome-session-properties- add startup program:
- Name:
PhanNas Desktop - Command:
/home/{username}/scripts/phanas_desktop/phanas_desktop.py - Comment: (empty)
- Name:
It will:
- spawn a minimal GTK+ window showing progress status and errors if any
- check NAS is online
- mount NAS drives to directories
/mnt/__NAS__/{username}/{drive_name}- mounting outside
$HOMEis required to avoid Nautilus loading the mounts and slowing down Gnome's login - mounting under
/mntis required to allow SNAP based applications (such as VLC) to access NAS drives
- mounting outside
- create directory
$HOME/__NAS__and create symlinks to each mounted drive - TODO: add directory
$HOME/__NAS__to Nautilus's bookmarks - synchronize keyfiles (if configured)
- execute a rsync-time-backup (RTB) based backup script (if configured)
- execute a NAS Copy based script (if configured)
- automatically close the windows 3 seconds after successful completion
Create a file {clone_directory}/config.phanas, which contains a JSON object to configure PhanNAS.
Entries:
keepass.keyfile: name of the keypass file to synchronize (location on NAS is hardcoded, local location is hardcoded to~)backup.script_path: path to the RTB based backup script to executenascopy.script_path: path to the NAS copy script to execute
Sample
{
"keepass": {
"keyfiles": [
"bar/foo.kdbx",
"donut/donut.kdbx"
]
},
"backup": {
"script_path": "/home/donut/scripts/backup_donut.sh"
},
"nascopy": {
"script_path": "/home/donut/scripts/nascopy/nascopy_donut.sh"
}
}Apache 2