Monday, 26 February 2007

Chmod and symbolic links

Seeing in the output of an ls -l command that my symlinks were world writable, I worried for a while and tried to change the permissions on them using chmod. That was a useless exercise, as is in fact pointed out in man chmod... permission to set symlinks is I guess governed by the directory's permissions.

Sunday, 25 February 2007

Quick note on remote access

I haven't quite figured out how to do it yet, but here are a few keywords to go with on my next look at this: OpenVPN, Tinc, STUN. (And should anyone come across this post who knows how to connect two systems that are behind NAT/firewall/routers, without changing the config of the routers, and using only open, well-audited code, please leave a comment!!)

Setting environment variables through bash scripts

Let's say you don't want to have certain variables set every time (through .bashrc). Setting them up by running a script doesn't exactly do what you want: it sets up your variables in the environment in the script, and then exits that environment on exiting the script.

Bash features a built-in command "source" to do the thing: it executes the commands in the script in the current environment. Here's an example (this is what I wanted to do today, setting extra library and header search paths for gcc):

#my scriptfile

cd /take/me/to/the/basedir/of/my/code/project

which, as a bonus, brings me straight to the right working directory to get on the job...
I found this solution starting here from a google search. The gcc variables are described in the book "An introduction to GCC" by Brian Gough, which is in fact also available online.