Friday, October 31, 2008

File permissions, chmod

Things to test with chmod.

drwxr-xr-x A typical directory
uuugggooo User Group Other
421421421 Bit values

* 1 --x Execute
* 2 -w- Write
3 -wx Write Execute
* 4 r-- Read
5 r-x Read Execute
6 rw- Read Write
7 rwx Read Write Execute

Use '-' or '+' to change permissions:
chmod u+x adds 1 to User if not already 1,3,5 or 7
chmod o-w subtracts 2 from Other if not already 1,4 or 5
chmod ugo+rwx adds 1,2 and 4 to all if not already 7


Use 'stat' to list more stuff about a file, like access rights in octal:

$ stat -c%a unixtime.txt
644
$ stat -c%A\ %h\ %U\ %G\ %s\ %z\ %n unixtime.txt
-rw-r--r-- 1 ker ker 300 2008-10-31 00:23:14.000000000 +0100 unixtime.txt
$ ls -lF --full-time unixtime.txt
-rw-r--r-- 1 ker ker 300 2008-10-31 00:23:14.000000000 +0100 unixtime.txt

See, looks like the output of 'ls -lF --full-time'

Wednesday, October 29, 2008

Remove module

A quick note to self:

Create a file /etc/modprobe.d/<module> with just blacklist <module>
Then:
depmod -ae
update-initramfs -u


(reboot, or just run rmmod <module> for now)

Sunday, October 26, 2008

vnc in ssh tunnel

I recommend using something else than port 22 for ssh. Edit /etc/ssh/sshd_config to change the port.

Create the vnc via variable for vnc:
Just:
export VNC_VIA_CMD='/usr/bin/ssh -2 -x -p 30022 -l user -f -L %L:%H:%R %G sleep 20'

Note the use of -p 30022, here's where I've changed the port to listen on for the ssh server. Also change "user" to a user name on the server.

No I can start the vnc client:
vncviewer -via mydomain.com 192.168.0.2:1

using mydomain.com as a gateway.

Sunday, October 19, 2008

Scotland 2008

Finally uploaded some pictures from the tour in Scotland to Flickr.
Have a look at http://flickr.com/photos/vigstrom/