I’m working on the “Day 10: Linux Bash Scripts” task, which requires creating a bash script (media_archive.sh) on App Server 3 that archives /var/www/html/media into xfusioncorp_media.zip, saves it to /archives, and copies it to the Nautilus Storage Server’s /archives directory without a password prompt and without using sudo.
Error received:
archive does not contain correct data on the Storage Server.
What I did:
- Installed
zipmanually (outside the script) usingsudo yum install -y zip - Set up passwordless SSH from App Server 3 (banner) to the Storage Server (natasha) using
ssh-keygen+ssh-copy-id - Created
/scripts/media_archive.sh:
bash
#!/bin/bash
SRC_DIR="/var/www/html/media"
ARCHIVE_NAME="xfusioncorp_media.zip"
ARCHIVE_PATH="/archives/${ARCHIVE_NAME}"
cd "$SRC_DIR" || { echo "Failed to cd into $SRC_DIR"; exit 1; }
zip -r "$ARCHIVE_PATH" .
scp "$ARCHIVE_PATH" natasha@ststor01:/archives/
- Made it executable with
chmod +x - Ran the script — it completed successfully with no password prompt and no sudo
Verification I did:
-
unzip -l /archives/xfusioncorp_media.zipon App Server 3 shows:index.html(39 bytes),.gitkeep(0 bytes) — 2 files -
ssh natasha@ststor01 "unzip -l /archives/xfusioncorp_media.zip"on the Storage Server shows the exact same 2 files with matching sizes and timestamps
Despite the archive contents matching exactly on both servers, the task is still marked as failed with “archive does not contain correct data on the Storage Server.”
Question: Is the checker expecting a specific internal structure inside the zip (e.g., the media folder/path preserved inside the archive, rather than the flattened file contents at the zip root)? Any clarification on what the grading script validates would help me correct this.
Screenshot of the failure and terminal output attached.
