harbor run -t LiteCoder/secure-file-sharing-setupharbor download LiteCoder/secure-file-sharing-setupConfigure a secure file-sharing environment on a headless Ubuntu server with authenticated access, automated backups, and audit logging. All configuration must be done via shell commands and config file edits.
openssh-server if not already installed./etc/ssh/sshd_config:
PermitRootLogin noPasswordAuthentication no (key-based auth only)Port 2222MaxAuthTries 3X11Forwarding noAllowGroups devteamdevteam.devteam group:
dev_alicedev_bobdev_charlie/home/./bin/bash.~/.ssh/ directory. Add each user's public key to their own ~/.ssh/authorized_keys file with permissions 600.~/.ssh/ directory for each user must have permissions 700./srv/devshare.root:devteam.2770 (setgid bit set so new files inherit the group)./srv/devshare:
code/docs/releases/root:devteam with permissions 2770./srv/backups/devshare./usr/local/bin/devshare_backup.sh that:
rsync to sync /srv/devshare/ to /srv/backups/devshare/./var/log/devshare_backup.log.755)./etc/cron.d/devshare_backup) that runs the backup script daily at 02:00 as root./usr/local/bin/devshare_backup_cleanup.sh that:
/srv/backups/devshare exists and is non-empty./var/log/devshare_backup.log (lines with timestamps older than 30 days)./var/log/devshare_cleanup.log.755)./etc/cron.d/devshare_cleanup) that runs this script every Sunday at 03:00 as root.auditd if not already installed./etc/audit/rules.d/devshare.rules with:
/srv/devshare for write, attribute change, read, and execute access (-p rwxa) with key devshare_access.fail2ban if not already installed./etc/fail2ban/jail.d/sshd_custom.conf with:
[sshd] sectionenabled = trueport = 2222maxretry = 3bantime = 3600findtime = 600Generate a JSON summary report at /app/output.json with the following structure:
{
"ssh": {
"port": 2222,
"permit_root_login": false,
"password_authentication": false,
"max_auth_tries": 3,
"allowed_groups": ["devteam"]
},
"users": ["dev_alice", "dev_bob", "dev_charlie"],
"group": "devteam",
"shared_directory": {
"path": "/srv/devshare",
"permissions": "2770",
"subdirectories": ["code", "docs", "releases"]
},
"backup": {
"source": "/srv/devshare/",
"destination": "/srv/backups/devshare/",
"script": "/usr/local/bin/devshare_backup.sh",
"schedule": "daily at 02:00",
"log": "/var/log/devshare_backup.log"
},
"cleanup": {
"script": "/usr/local/bin/devshare_backup_cleanup.sh",
"schedule": "weekly on Sunday at 03:00",
"log": "/var/log/devshare_cleanup.log"
},
"audit": {
"rules_file": "/etc/audit/rules.d/devshare.rules",
"watch_path": "/srv/devshare",
"key": "devshare_access"
},
"fail2ban": {
"jail_config": "/etc/fail2ban/jail.d/sshd_custom.conf",
"port": 2222,
"maxretry": 3,
"bantime": 3600
}
}
All services that are installed must be enabled (but do not need to be actively running if the environment does not support it). All files, directories, scripts, cron jobs, and configurations described above must exist on disk with the specified paths and settings.