What’s the best way of handling permissions for apache2’s user www-data in /var/www ?


Avec des Acls

I think you may find POSIX ACL (access control lists) to be helpful. They allow a finer-grained permission model compared to the user:group:other model. I have found them to be easier to keep straight in my head since I can be more explicit and can also set the "default" behavior for a branch of the file system.

For example, you can specify each user's permissions explicitly:

setfacl -Rm d:u:userA:rwX,u:userA:rwX /var/www
setfacl -Rm d:u:userB:rwX,u:userB:rwX /var/www

Or you can do it based on some shared group:

setfacl -Rm d:g:groupA:rwX,u:groupA:rwX /var/www

And perhaps you want to keep your Apache user as read-only

setfacl -Rm d:u:www-data:rX,u:www-data:rX /var/www

Man pages:

Purger un projet à déployer vers un serveur web

rm -rf `find . -type d -name .svn`
rm -rf `find . -type d -name .cache`
rm -rf `find . -type d -name .settings`
rm -rf `find . -type d -name __MACOSX`
rm -rf `find . -name .DS_Store`
rm -rf `find . -name .project`
rm -rf `find . -name "*.pyc"`

Faire un import "sur place" dans SVN


Voici commentr transformer des données originales en un espace de travail.

Disons que vous souhaitez faire du répertoire ~/working/toto le ~/repo/project/trunk de votre dépôt.

cd ~/working/toto
svn checkout file:///~/repo/project/trunk .
svn add *
svn commit -m "Initial import"

Vous souhaitez ajouter le répertoire ~/etc ?

svn mkdir file:///~/repo/project/trunk/etc \
        -m "Make a directory in the repository to correspond to /etc"
cd ~/etc
svn checkout file:///~/repo/project/trunk/etc .
svn add apache samba alsa X11 
svn commit -m "Initial version of my config files"

This takes advantage of a not-immediately-obvious feature of svn checkout: you can check out a directory from the repository directly into an existing directory. Here, we first make a new empty directory in the repository, and then check it out into /etc, transforming /etc into a working copy. Once that is done, you can use normal svn add commands to select files and subtrees to add to the repository.

tar / untar


décompresser une archive

tar -xzvf archive.tar.gz

compresser un répertoire

tar -czvf archive.tar.gz MonRepertoire

Paste Mode: Pasting text (and indenting it) in Vim


Pasting a block of code copied from elsewhere in Vim is a nightmare, unless you know how to do it right. The autoindent (and, possibly, smartindent) features of Vim go crazy when you yank and slap a block of text. How do you do it right, then? This is not a new trick, but something I did not know about for a long time, so I suppose it is reasonable to assume many others who use Vim may not have come across it either. It is called the paste mode. In Vim, you can enable the paste mode by typing :set paste on Vim’s command interface. Once the paste mode is enabled, you can paste the block(s) of code you have yanked from elsewhere, and disable the paste mode through the command :set nopaste as soon as you are done with pasting text. A bit inconvenient, but it is a handy feature to get familiar with if you use Vim a lot to write code.

Installer Sphinx sur OSX

Ce tuto utilise wget, qui n'est pas installé sur Leopard. Pour l'installer, la procédure est disponible ici.

# Download sphinx
wget http://sphinxsearch.com/downloads/sphinx-0.9.9-rc2.tar.gz
tar zxvf sphinx-0.9.9-rc2.tar.gz

cd sphinx-0.9.9-rc2/

# Add stemming support
wget http://snowball.tartarus.org/dist/libstemmer_c.tgz
tar zxvf libstemmer_c.tgz

./configure --with-libstemmer

sudo make install