This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # find all lines not beginning with an # | |
| cat somefile | grep -v "^#" | |
| # split all lines to get only the part before the first # | |
| cat somefile | cut -d'#' -f1 | |
| # remove all comments | |
| cat somefile | grep -v "^#" | cut -d'#' -f1 | |
| # List all users |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://forums.freebsd.org/threads/howto-setting-up-public-key-password-less-ssh-access.1508/ | |
| # http://unix.stackexchange.com/questions/42643/ssh-key-based-authentication-known-hosts-vs-authorized-keys | |
| # https://www.digitalocean.com/community/tutorials/how-to-configure-ssh-key-based-authentication-on-a-freebsd-server | |
| # Generate key on client | |
| ssh-keygen -t rsa | |
| # Generate key on server | |
| ssh-keygen -t rsa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### Server ### | |
| # create user | |
| # become someuser | |
| su someuser | |
| # to home directory of someuser | |
| cd ~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MD5_FILE="md5_file" | |
| FILE="somefile" | |
| # create MD5 of somefile | |
| md5=`md5 $FILE | cut -d'=' -f2 | tr -d " "` | |
| # Write md5 to file | |
| md5 > $MD5_FILE | |
| # Get MD5 from file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://premium.wpmudev.org/blog/understanding-file-permissions/ | |
| # http://www.smashingmagazine.com/2014/05/proper-wordpress-filesystem-permissions-ownerships/ | |
| # Change directory permissions to 755 (d, rwx, r-x, r-x) | |
| sudo find . -type d -exec chmod 755 {} + | |
| find /path/to/your/wordpress/ -type d -exec chmod 755 {} \; | |
| # Change file permissions to 644 (-, rw-, r--, r--) | |
| sudo find . -type f -exec chmod 644 {} + | |
| find /path/to/your/wordpress/ -type f -exec chmod 644 {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql | |
| # https://www.digitalocean.com/community/tutorials/a-basic-mysql-tutorial | |
| # Create a new database | |
| CREATE DATABASE somedatabase | |
| # Create a new user | |
| CREATE USER 'someuser'@'localhost' IDENTIFIED BY 'somepassword'; | |
| # Delete a user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html | |
| # https://mozilla.github.io/server-side-tls/ssl-config-generator/ | |
| # Install letsencrypt | |
| portmaster -ydbg --no-confirm security/py-letsencrypt | |
| # Generate dhparam file | |
| openssl dhparam -out dhparam.pem 4096 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Find php ports | |
| portmaster -L | grep php | sed -e "s/===>>> //g" | sed -e "s/-5.6.18_1//g" | sed -e "s/-5.6.18//g" | sed -e "s/-1.0//g" | |
| # Uninstall ports | |
| portmaster -L | grep php | sed -e "s/===>>> //g" | sed -e "s/-5.6.18_1//g" | sed -e "s/-5.6.18//g" | sed -e "s/-1.0//g" | xargs -I {} sh -c 'portmaster -ye --no-confirm {}' | |
| php56 | |
| php56-ctype | |
| php56-curl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### Start screen session ### | |
| # http://stackoverflow.com/questions/7049252/how-to-create-a-screen-executing-given-command | |
| function exec_in_screen() { | |
| name=$1 | |
| command=$2 | |
| screen -dmS $name sh; screen -S $name -X stuff "$command\n"; | |
| } | |
| exec_in_screen "test" "ls" |