Chmod codes explained

Codes below for quick reference:

All seven permissions are listed below, with their numeric values on the left.
1. –x
2. -w-
3. -wx
4. r–
5. r-x
6. rw-
7. rwx

Common combinations in use on web servers are as follows:

644 = rw-r–r– Usual permissions for reading an HTML web page or Read-only text files.
664 = rw-rw-r– Used in most plain text hit-counter logs (writable = on)
666 = rw-rw-rw- Used in scripts that require World writable permission.
711 = rwx–x–x Used by Perl scripts to make them executable only upon access.
751 = rwxr-x–x Used by Perl scripts that must be written to and executed (hit counters).
755 = rwxr-xr-x Used by some Perl-scripts and binary database files.
775 = rwxrwxr-x Normal permission for your website’s Root directory
777 = rwxrwxrwx The whole ball of wax. You better have tight security on any file marked with these permissions. 777 is usually only assigned to a CGI Directory, rather than to an individual file.

source

Running Django in a Rackspace cloud

Problem

Run Django in a Rackspace server and be able to restart the services if necesary.

Solution

It is rather easy to have a copy of Django running on the cloud if you follow the steps to the letter in the tutorial here. One of the problems that I personally encountered was to kill the Python service and then bring it back to continue development.

You need to find the ID that the service is using in order to “kill” it. One effective way that I found to display all the services that are running is by running the following command:

$ ps ux

Once you get a list of all the services running you can find the ID of those running under Python. In my case mine was ID 4193. So all I have to do is the following:

$ kill -9 4193

Do any changes I need that need to be made which were necessary to stop the service and run it again

$ python /projects/sample_project/manage.py runfcgi host=127.0.0.1 port=8080 –settings=settings

Extras

As an extra feature I added couple of aliases to help me to run commands faster:

alias start=’/etc/init.d/nginx start’
alias stop=’/etc/init.d/nginx stop’
alias restart=’/etc/init.d/nginx restart’
alias py=’python /projects/sample_project/manage.py runfcgi host=127.0.0.1 port=8080 –settings=settings’

Adding serveral unversioned files to an existing repository

Problem

You have already added a directory to SVN and you need to add several new files to SVN. As you may know the default way to add new files to an existing repository is by doing the following:

$ svn add filename1.ext
$ svn add filename2.ext

or one line

$ svn add filename1.ext filename2.ext

this works well when you have a few file names but how about several files that need to be added at once and with complex names?

Solution

You can add the –force option when re-adding a directory

$ svn add directorycontainingfiles –force

If you want to take it a step further you can clean up your directories from those extra hidden files:

$ find . -name ‘*.DS_Store’ -type f -delete