This guide shows how to set up a shared guestbook on a tildeverse server, with logging to track who added entries and when.
This setup creates:
• A guestbook.txt file for public entries (read-only, script-accessible only)
• A guestbook.log file to track changes (writable)
• A script that adds entries with timestamps and user attribution
• Secure permissions that prevent direct file editing while allowing script access
micro ~/guestbook.txt
Then, add a header like this:
# Guestbook ============
micro ~/guestbook.log
Add this content to the file:
# Guestbook Change Log # Format: [timestamp] username: action
Create a script called ~/guestbook-add.sh:
micro ~/guestbook-add.sh
Add this content to the script:
#!/bin/sh
# Guestbook entry script with logging
# Usage: ./guestbook-add.sh
GUESTBOOK="$HOME/guestbook.txt"
LOGFILE="$HOME/guestbook.log"
DATE=$(date '+%Y-%m-%d %H:%M:%S')
USERNAME=$(whoami)
# Check if guestbook exists
if [ ! -f "$GUESTBOOK" ]; then
echo "Error: Guestbook file not found at $GUESTBOOK"
exit 1
fi
# Log the action
echo "[$DATE] $USERNAME: Added entry" >> "$LOGFILE"
# Create temp file for content validation
TEMPFILE=$(mktemp)
# Prompt for entry (if interactive) or read from stdin
if [ -t 0 ]; then
echo "Enter your guestbook entry (press Ctrl+D when done):"
cat > "$TEMPFILE"
else
cat > "$TEMPFILE"
fi
# Add separator and entry
echo "" >> "$GUESTBOOK"
echo "---" >> "$GUESTBOOK"
echo "Added by $USERNAME on $DATE:" >> "$GUESTBOOK"
echo "" >> "$GUESTBOOK"
# Add the content
cat "$TEMPFILE" >> "$GUESTBOOK"
echo "" >> "$GUESTBOOK"
# Clean up
rm "$TEMPFILE"
echo "Entry added to guestbook!"
chmod +x ~/guestbook-add.sh
Make the guestbook file read-only (only accessible via script), but keep the log writable:
chmod 644 ~/guestbook.txt chmod 666 ~/guestbook.log chmod 755 ~/guestbook-add.sh
This setup ensures:
• Users can only add entries via the script
• Direct editing of guestbook.txt is prevented
• The log file remains writable for tracking changes
Interactive mode:
~/guestbook-add.sh
Then type your entry and press Ctrl+D when done.
You can also pipe content to the script:
echo "Hello from the tildeverse!" | ~/guestbook-add.sh
Or from a file:
cat my-entry.txt | ~/guestbook-add.sh
cat ~/guestbook.txt less ~/guestbook.txt
cat ~/guestbook.log tail ~/guestbook.log # Show recent entries
Create ~/guestbook-view.sh:
micro ~/guestbook-view.sh
Add this content:
#!/bin/sh # View guestbook with recent changes echo "=== GUESTBOOK ===" cat ~/guestbook.txt echo "" echo "=== RECENT CHANGES ===" tail -10 ~/guestbook.log
Make it executable:
chmod +x ~/guestbook-view.sh
Create ~/guestbook-clear.sh (use with caution!):
micro ~/guestbook-clear.sh
Add this content:
#!/bin/sh
# Clear guestbook (requires confirmation)
echo "This will clear the guestbook. Are you sure? (yes/no)"
read answer
if [ "$answer" = "yes" ]; then
DATE=$(date '+%Y-%m-%d %H:%M:%S')
USERNAME=$(whoami)
echo "[$DATE] $USERNAME: Cleared guestbook" >> ~/guestbook.log
echo "# Guestbook" > ~/guestbook.txt
echo "============" >> ~/guestbook.txt
echo "" >> ~/guestbook.txt
echo "Guestbook cleared."
else
echo "Operation cancelled."
fi
Make it executable:
chmod +x ~/guestbook-clear.sh
• Users can only add entries via the script
• Direct editing of guestbook.txt is prevented (644 permissions)
• Changes are logged with username and timestamp
• Script provides controlled access with attribution
• Log file remains writable for tracking
• Prevents accidental deletion or corruption
• Ensures all entries are logged and attributed
• Maintains consistent formatting
• Allows for future content filtering in the script
• Reduces risk of malicious content injection
If your tilde server supports groups:
# Create a group (requires admin access) # Add trusted users to the group chgrp guestbook-users ~/guestbook.txt chmod 664 ~/guestbook.txt
Add basic content filtering to the script:
# Add to guestbook-add.sh after the cat command
# Filter out common spam patterns
TEMPFILE=$(mktemp)
cat > "$TEMPFILE"
if grep -qi "viagra\|casino\|lottery\|porn" "$TEMPFILE"; then
echo "Entry rejected: inappropriate content detected"
rm "$TEMPFILE"
exit 1
fi
cat "$TEMPFILE" >> "$GUESTBOOK"
rm "$TEMPFILE"
Archive old entries periodically:
# Create archive cp ~/guestbook.txt ~/guestbook-$(date +%Y%m).txt # Clear current file ~/guestbook-clear.sh
Prevent log files from growing too large:
# Archive old logs mv ~/guestbook.log ~/guestbook-$(date +%Y%m).log touch ~/guestbook.log echo "# Guestbook Change Log" > ~/guestbook.log
ls -lh ~/guestbook*
Add email notification to the script:
# Add to guestbook-add.sh echo "New guestbook entry from $USERNAME" | mail -s "Guestbook Update" your-email@tilde.pink
Create a gemini version of your guestbook:
mkdir -p ~/public_gemini ln -s ~/guestbook.txt ~/public_gemini/guestbook.gmi
Your guestbook will be available at:
gemini://tilde.pink/~username/guestbook.gmi
chmod +x ~/guestbook-add.sh chmod +x ~/guestbook-view.sh chmod +x ~/guestbook-clear.sh
chmod 666 ~/guestbook.log
The guestbook should be read-only (644) - users access it via the script:
chmod 644 ~/guestbook.txt
Check file permissions and ownership:
ls -l ~/guestbook*
Ensure the script is executable and you have proper permissions:
ls -l ~/guestbook-add.sh
Implement log rotation (see Maintenance section)
If your tilde server supports web hosting, consider using a proper guestbook application.
Have users email entries to you, then add them manually.
Use git to track changes:
cd ~ git init git add guestbook.txt guestbook.log git commit -m "Initial guestbook setup"
Consider adding a header to your guestbook:
# Guestbook Guidelines # • Be respectful and kind # • No spam or self-promotion # • Keep entries relatively short # • This is a public space, be mindful of what you share
Main Site
Gemini capsule
Contact
© 2026 Brennan Kenneth Brown. Content available under CC BY-SA