Tuesday, February 28, 2012

Linux/Unix misc

  • Configuration file for the ls color command is /etc/DIR_COLORS for Linux
  • sftp only
  • Using loop devices is very convenient when training with Raid for instance. To create usable devices for a Raid, it works as for a file-system, except that instead of mounting the file as a loop device they must be setup with the tool ”losetup” that is part of the Linux utilities. In fact, it is not possible to prepare devices for a Raid that are already mounted, and losetup makes a loop device in /dev/ ready to be mounted in a way that it is possible to run ”mount /dev/loop0 mount-point” instead of ”mount -o loop file mount-point”.

    Preparing a Raid5 works as follow:
    1. Create 3 files:
      • dd bs=1M count=100 if=/dev/zero of=0
      • dd bs=1M count=100 if=/dev/zero of=1
      • dd bs=1M count=100 if=/dev/zero of=2
    2. Setup loop devices:
      • losetup /dev/loop0 0
      • losetup /dev/loop1 1
      • losetup /dev/loop2 2
    3. Prepare the Raid5 device:
      • mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/loop0 /dev/loop1 /dev/loop2
    4. Mount the Raid5 device:
      • mount /dev/md0 mount-point
  • Why VNC not showing actual Remote Desktop
    • vncserver doesn't connect to the actual desktop; it creates a virtual desktop that is configured separately, on another display, probably :1. the X11 session defined in ~/.vnc/xstartup, a minimal X11 session. 
    • To access a different desktop that looks the same, you have to start it in this xstartup file, e.g. with exec gnome-session or something similar, have a look for documentation on xinitrc or xsession[rc])
    • To access the same desktop session, you need a different VNC server. x11vnc can dodesktop sharing; in your GNOME environment, Vino is probably the preferable choice
    • you might be able to use Xvnc with inetd as described in its man page (last paragraph of the linked section). Another (kind of high-overhead but neat) solution might be using the Guacamole remote desktop gateway and configuring access there
    • Please uncomment following two lines in xstartup file under ~/.vnc/xstartup:
      Before:
      #unset SESSION_MANAGER
      #exec /etc/X11/xinit/xinitrc
      
      [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
      [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
      xsetroot -solid grey
      vncconfig -iconic &
      xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
      twm &
      
      After:
      unset SESSION_MANAGER
      exec /etc/X11/xinit/xinitrc
      
      [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
      [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
      xsetroot -solid grey
      vncconfig -iconic &
      xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
      twm &
  • ttt