![]() |
|
05-22-2012
|
1 |
|
Graalian
Join Date: Dec 2011
Posts: 986
|
Dont trust the internet.
Was working on my server today, trying to see if I could get something that would restart my server every now and then to reduce lag. I found something that looked perfect! It was a .sh file that you run though terminal (Mac command prompt). Anyways, I ran it with "sudo sh mac_install.sh" aaand. It changed every single one of my permissions on my entire computer (except the admin account) to no read/write/or execute. (000?) Tl;dr DON'T TRUST THE INTERNET |
|
05-22-2012
|
2 |
|
Registered User
Join Date: Dec 2011
Location: Blacksburg, Virginia
Posts: 5,459
|
View .sh files before you execute them.
|
|
05-22-2012
|
3 | |
|
Graalian
Join Date: Dec 2011
Posts: 986
|
![]() It apparently is supposed to change one permission, but it changed them all>.> |
|
|
05-22-2012
|
4 |
|
Should be fixed.
Join Date: Aug 2011
Posts: 6,359
|
But... Mac's are impervious!
|
|
05-22-2012
|
5 |
|
Registered User
Join Date: Apr 2016
Location: Testbed
Posts: 604
|
Poorly written that it had chmod all over the place and you didn't notice? What the hell? Also, learn cronjob. You could have added something quickly to restart your computer every set period of time (e.g. every saturday at 4:00am or whatever). I'm guessing OSX has cronjob (or something similar). If not? Lame. |
|
05-22-2012
|
6 | |
|
Graalian
Join Date: Dec 2011
Posts: 986
|
TYVM!! Setting this upNot quite sure how this code changed all my permissions... HTML Code:
#!/bin/bash
# URL to the Download Directory, NOT the file
URL="http://dl.xereo.net/open/"
# Filename derp
FILENAME="1.1.00-full.zip"
# URL to installation script
INSTURL="http://dl.nope.bz/sb/mac_install.sh"
# URL to the unzip binaries
URLUZ="http://dl.nope.bz/sb/.bin/unzip"
if [ "$(id -u)" != "0" ]
then
echo "This script must be run as root!" 1>&2
exit 1
#elif [ -z $BASH ]
#then
# echo "You need to execute this script in bash!" 1>&2
# exit 1
fi
if [ "$(pwd)" = '/' ] || [ "$(pwd)" = '/home' ] || [ "$(pwd)" = '/opt' ] || pwd | grep '^/Applications' > /dev/null \
|| pwd | grep '^/Developer' > /dev/null || pwd | grep '^/Library' > /dev/null \
|| pwd | grep '^/Network' > /dev/null || pwd | grep '^/System' > /dev/null \
|| pwd | grep '^/Volumes' > /dev/null || pwd | grep '^/bin' > /dev/null || pwd | grep '^/cores' > /dev/null \
|| pwd | grep '^/dev' > /dev/null || pwd | grep '^/efi' > /dev/null || pwd | grep '^/lost+found' > /dev/null \
|| pwd | grep '^/net' > /dev/null || pwd | grep '^/opt' > /dev/null || pwd | grep '^/private' > /dev/null \
|| pwd | grep '^/sbin' > /dev/null || pwd | grep '^/usr' > /dev/null || pwd | grep '^/home/[^/]*$' > /dev/null \
|| pwd | grep '^/home/[^/]*/Desktop' > /dev/null || pwd | grep '^/home/[^/]*/Videos' > /dev/null \
|| pwd | grep '^/home/[^/]*/Pictures' > /dev/null || pwd | grep '^/home/[^/]*/Documents' > /dev/null \
|| pwd | grep '^/home/[^/]*/Music' > /dev/null || pwd | grep '^/home/[^/]*/Templates' > /dev/null \
|| pwd | grep '^/home/[^/]*/Downloads' > /dev/null
then
echo "Anti bumblebee security system engaged."
echo "Please execute the script in another directory, you were about to delete important files, and we don't want that :("
exit 1
fi
if [ "$1" = "-u" ] || [ "$1" = "--update" ]
then
echo "Are you sure you want to upgrade SpaceCP in this directory? Everything (except your settings) in it will be deleted! Y/[N] \c"
read inputline
if [ "$inputline" = "N" ] || [ "$inputline" = "n" ] || [ "$inputline" = "no" ] || [ "$inputline" = "NO" ] || [ "$inputline" = "No" ] || [ "$inputline" = "nO" ] || [ "$inputline" = "" ]
then
echo "Exiting..."
exit 0
fi
echo "Deleting old files...\c"
for i in $(ls -A ./ | grep -v "app")
do
rm -r $i
done
cd app/
for i in $(ls -A ./ | grep -v "Config" | grep -v "webroot")
do
rm -r $i
done
cd webroot/
for i in $(ls -A ./ | grep -v "servers")
do
rm -r $i
done
cd ../Config/
for i in $(ls -A ./ | grep -v "database.php")
do
rm -r $i
done
cd ../../
echo "\t\tOK"
echo "Downloading SpaceCP...\c"
i=0
success=0
while [ $i -lt 5 ] && [ $success -eq 0 ]
do
if curl --silent "$URL$FILENAME" -o $FILENAME > /dev/null
then
success=1
else
(( i += 1 ))
fi
done
if [ $success -eq 1 ]
then
echo "\t\tOK"
else
echo "\t\tERROR"
echo "Could not download the panel! Maybe try again or ask us for support!\n"
exit 1
fi
echo "Unzipping...\c"
if unzip -nqq $FILENAME > /dev/null
then
chmod -R 777 app/tmp app/webroot app/Config/database* app/configuration*
chown -R www:www *
rm $FILENAME
rm app/tmp/inst.txt
curl --silent $INSTURL -o mac_install.sh > /dev/null
echo "\t\t\tOK"
echo "\nEverything has been updated correctly! Enjoy SpaceCP!\n"
exit 0
else
echo "\t\t\tERROR"
echo "Problems unzipping the panel! Something went wrong, maybe try again or ask us for support!\n"
exit 1
fi
fi
#dep4=0
#for i in $(find /etc/ -name php.ini -exec grep -c ^\;extension=php_gd2 {} \;)
#do
# [ $i -eq 1 ] && dep4=1 && break
#done
#if [ $dep4 -eq 1 ]
#then
# inputline="Y"
# echo "You don't have PHP-gd2 enabled. SpaceCP will need it. Do you want to enable PHP-gd2 now? [Y]/n \"
# read inputline
# if [ "$inputline" = "Y" ] || [ "$inputline" = "y" ] || [ "$inputline" = "yes" ] || [ "$inputline" = "YES" ] || [ "$inputline" = "Yes" ] || [ "$inputline" = "" ]
# then
# echo "Enabling PHP-gd2...\c"
# for i in $(find /etc/ -name php.ini -exec grep -c ^\;extension=php_gd2 {} \;)
# do
# sed -i 's/\;extension=php_gd2/extension=php_gd2/' $i
# done
# echo "\t\tOK"
# dep4=1
# else
# echo "Not enabling PHP-gd2... (You will need to do it manually)\n"
# fi
#fi
echo "Downloading SpaceCP now...\c"
i=0
success=0
while [ $i -lt 5 ] && [ $success -eq 0 ]
do
if curl --silent "$URL$FILENAME" -o $FILENAME > /dev/null
then
success=1
else
(( i += 1 ))
fi
done
if [ $success -eq 1 ]
then
echo "\tOK"
else
echo "\tERROR"
echo "Could not download the panel! Maybe try again or ask us for support!\n"
exit 1
fi
echo "Unzipping...\c"
if unzip -oqq $FILENAME > /dev/null
then
chmod -R 777 app/tmp app/webroot app/Config/database* app/configuration*
chown -R www:www *
rm $FILENAME
echo "\t\t\tOK"
echo "\nEverything has been unzipped, modded and owned correctly!\nYou now have a perfect copy of the awesome SpaceCP Panel! \o/ *!party!* \o/\n"
exit 0
else
echo "\t\t\tERROR"
echo "Problems unzipping the panel! Something went wrong, maybe try again or ask us for support!\n"
exit 1
fi
|
|
|
05-22-2012
|
7 |
|
Dark Desert Fox
Join Date: Sep 2011
Location: United States, Ohio
Posts: 5,720
|
Never have and never will.
|
|
05-22-2012
|
8 | ||
|
Registered User
Join Date: Dec 2011
Location: Blacksburg, Virginia
Posts: 5,459
|
|
||
|
05-22-2012
|
9 |
|
is Lazy
Join Date: Dec 2011
Location: Graal Guild House
Posts: 245
|
|
|
05-22-2012
|
10 |
|
Graalian
Join Date: Dec 2011
Posts: 986
|
I fail to see how chmod 777 changes it to 000..
|
|
05-22-2012
|
11 |
|
Classic
Join Date: Aug 2011
Location: New York City
Posts: 908
|
|
|
05-22-2012
|
12 |
|
:)
Join Date: Sep 2011
Location: no.
Posts: 10,309
|
|