Skip to content

Instantly share code, notes, and snippets.

@imperzer0
Last active September 13, 2022 06:30
Show Gist options
  • Save imperzer0/f381ab93da4dfa939a54ee6194ad162d to your computer and use it in GitHub Desktop.
Save imperzer0/f381ab93da4dfa939a54ee6194ad162d to your computer and use it in GitHub Desktop.
filestorage typical environment configuration
#!/bin/bash
dd if=/dev/random of=filestorage_container bs=1M count=<megabytes>
mkfs.ext4 filestorage_container
sudo mount --mkdir filestorage_container storage/
ls -alshp storage/
sudo umount $(realpath filestorage_container)
#!/bin/bash
echo " BASH > Opening ports..."
sudo iptables -I INPUT -p tcp -m tcp --dport 14886 -j ACCEPT
sudo iptables -I OUTPUT -p tcp -m tcp --dport 14886 -j ACCEPT
echo " BASH > Opened."
echo " BASH > Mounting volume..."
sudo mount filestorage_container storage
echo " BASH > Mounted."
echo " BASH > Running server..."
cd storage/
echo " BASH > PWD = \"$(pwd)\""
filestorage --address ":14886" --loglevel 3 --password <password>
echo " BASH > Execution finished."
cd ../
echo " BASH > PWD = \"$(pwd)\""
echo " BASH > Unmounting volume..."
sudo umount "$(realpath filestorage_container)"
echo " BASH > Unmounted."
echo " BASH > Closing ports..."
sudo iptables -D INPUT -p tcp -m tcp --dport 14886 -j ACCEPT
sudo iptables -D OUTPUT -p tcp -m tcp --dport 14886 -j ACCEPT
echo " BASH > Closed."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment