I hereby claim:
- I am montgomerykern on github.
- I am montgomerykern (https://keybase.io/montgomerykern) on keybase.
- I have a public key ASBNmjFotarE6HAhnLulweUTpkabW5scUfZRksQi-AUA7go
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
ziping files/directories examples | |
Creates the archive data.zip and puts all the files in the current directory in it in compressed form, type: | |
$ zip data * | |
Note: No need to add .zip extension or suffix as it is added automatically by zip command. | |
Use the ls command to verify new zip file: | |
$ ls |
Set up a 1 GB swap file | |
Adding a swap file gives Discourse some extra breathing room during memory-intensive operations. 1GB swap should suffice, though if you are attempting the minimum memory configuration you should set up a 2GB swap. | |
In the shell you have opened to your droplet, do the following: | |
Create an empty swapfile | |
sudo install -o root -g root -m 0600 /dev/null /swapfile |
Scanning your server for 777 files and directories | |
Why are 777 files and directories dangerous: | |
A directory or file that is set to 777 is open to the world (in some cases) for writing. So if you are a hacker who knows what they are doing, they can exploit a 777 directory, insert code and even files into your server and then use that file or code to affect more files on your server. | |
A 777 directory should be used sparingly and sometimes not at all. It is most often used when there are IMAGES that need to be uploaded or any file types that can not be executed. Or in cases where directories are totally secure ahead of time through programming. | |
What about php and html files: |
# for directories | |
find . -type d -print0 | xargs -0 chmod 0755 | |
# for files | |
find . -type f -print0 | xargs -0 chmod 0644 | |
#Cent OS Based | |
find . -type d -perm 777 -exec chmod 755 {} \; (for changing the directory permission) |
# mv source dest | |
# mv /path/to/source /path/to/dest | |
# | |
# mv /var/www/vhost/domain.com /var/www/html/ | |
How do I Move Multiple Directories? | |
Use the following syntax to move dir1 and dir2 to /path/to/dest/ directory: | |
$ mv -v dir1 dir2 /path/to/dest/ |
#!/bin/bash | |
date; | |
echo "uptime:" | |
uptime | |
echo "Currently connected:" | |
w | |
echo "--------------------" | |
echo "Last logins:" | |
last -a |head -3 | |
echo "--------------------" |
#!/bin/bash | |
#Root Mail User Email Dump Script | |
cat /dev/null > /var/mail/root |
mkdir /mnt/xs-tools | |
mount /dev/cdrom /mnt/xs-tools | |
cd /mnt/xs-tools/Linux/ | |
bash install.sh |
$ service openvswitch stop | |
$ xe-toolstack-restart | |
$ service openvswitch start |