OpenSSH server on Windows using Cygwin

Sometime I need to automate some task on windows, and it’s a pain.

A solution I found is to set up an ssh server on windows and execute remotely most of the tasks.

First you have to install Cygwin and select the openssh package.

Then open an Administrator Cygwin console and type:

ssh-host-config -y -c "tty ntsec"

This will accept all the defaults and add the support for the NT system user accounts (untested).

Then you will have to add an exception for the sshd service in the windows firewall, it is located in:

C:\cygwin\usr\sbin\sshd.exe

If needed you can add your public ssh key in the .ssh/authorized_keys in your cygwin home.

If you trust the machine, you can activate the agent forwarding, but to make that work you have to start an ssh-agent in your .profile or .bashrc:

if [ -z "$SSH_AUTH_SOCK" -a -x ssh-agent ]; then
	eval $(ssh-agent -s)
	trap "kill $SSH_AGENT_PID" 0
fi

Now you can start the server from your Administrator Cygwin console:

net start sshd

Done!

References

Disable Bamboo Finger in xorg with multitouch

I had a problem on my Mac using my Wacom Bamboo Touch and Pen. I cannot disable the Finger input, it was not detected listing the devices:

$ xsetwacom --list devices
Wacom Bamboo Craft Pen stylus id: 9 type: STYLUS 
Wacom Bamboo Craft Pen eraser id: 14 type: ERASER 

Given the fact I was able to disable the Touch input on another machine without trackpad, I started searching for my lost input.

My xorg.conf is very simple:

$ cat /etc/X11/xorg.conf

Section "InputClass"
	MatchIsTouchpad "true"
	Identifier "touchpad"
	Driver "multitouch"
EndSection

Section "Device"
	Identifier	"Default Device"
	Option	"NoLogo"	"True"
EndSection

hmmm… perhaps the MatchIsTouchpad is grabbing some input before it can reach the wacom driver…

Grepping for Trackpad in dmesg I found that I can refine the Match for the InputClass to match something in:

$ dmesg | grep -C3 -i trackpad
[    2.976094] usb 3-6: new full-speed USB device number 2 using ohci_hcd
[    3.200107] usb 3-6: New USB device found, idVendor=05ac, idProduct=0237
[    3.200113] usb 3-6: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    3.200116] usb 3-6: Product: Apple Internal Keyboard / Trackpad
[    3.200119] usb 3-6: Manufacturer: Apple Inc.
[    3.231183] usbcore: registered new interface driver usbhid

For example:

$ diff -u X11/xorg.conf.old X11/xorg.conf
--- X11/xorg.conf.old	2013-04-23 22:52:24.256969000 +0200
+++ X11/xorg.conf	2013-04-23 23:02:09.688969000 +0200
@@ -1,5 +1,6 @@
 
 Section "InputClass"
+	MatchVendor "Apple Inc."
 	MatchIsTouchpad "true"
 	Identifier "touchpad"
 	Driver "multitouch"

Now I can succesfully list the Finger input

$ xsetwacom --list devices
Wacom Bamboo Craft Pen stylus   	id: 9	type: STYLUS    
Wacom Bamboo Craft Finger touch 	id: 10	type: TOUCH     
Wacom Bamboo Craft Pen eraser   	id: 14	type: ERASER    
Wacom Bamboo Craft Finger pad   	id: 15	type: PAD       

and disable it in my .xinitrc

$ cat .xinitrc 
#!/usr/bin/env bash
xsetwacom --set "Wacom Bamboo Craft Finger touch" Touch off
export $(gnome-keyring-daemon -r)
export $(gnome-session)

Upgrade MacBook (13-inch, Mid 2010) Hard Disk

If you have a MacBook and you want a dual boot system, perhaps you will soon fill at least one of your partition., because unluckily HFS+ is writable only with journaling disabled from Linux (yes, this time the kernel without GNU!), and the same is for ext4 from OsX.

But this is not a problem! Storage is cheep!

The steps for a successful upgrade are:

  1. Buy a external HD (I found a Trans 500GB StoreJet2.5in, well done, easy to open, but you will have to «remove the ‘do not remove’ stickers»)
  2. Burn the latest Clonezilla live CD
  3. Follow the device-device mode and clone you disk (I had a 2GB/min average speed)
  4. Follow the official MacBook User Guide to remove the old hard-disk from the MacBook.
    1. pinzeThe guide is ok, but if you don’t have the right tool to open the 4 mounting Torx screws placed on the disk itself, you can carefully use some pliers (as I did).
  5. Swap the drives and reboot.

In my experience everything was ok, and I got a working copy of the disk with 250GB of unpartitioned space.

Now launch gdisk (GPT enabled fdisk), backup the GPT table and add the new partitions you want. I forgot to backup the GPT (you can’t backup it on the drive you are working on…), but luckily I took a picture of the partitions listing with my phone. That saved me from a complete failure :)
Now it’s the turn of LVM2 and btrfs!

Modificare il titolo del teminale da Python

Una delle particolarità di gentoo è l’attenzione ai particolari, ed una delle caratteristiche che rimpiango in altri gestori di pacchetti è l’uso intelligente della barra del titolo della finestra del terminale per comunicare lo stato di avanzamento di una lunga installazione.

Andando a scavare nei sorgenti di portage ho trovato una comoda funzione, xtermTitle(message) (nel file output.py), che modifica il titolo di xTerm (o similari) con il messaggio inviato.

Qua ho adattato (minimamente) la funzione ai miei usi:


def xtermTitle(message):
if os.environ.has_key("TERM") and sys.stderr.isatty():
this_term = os.environ["TERM"]
legal_terms = ["xterm", "Eterm", "aterm", "rxvt",
"screen", "kterm", "gnome"]
for term in legal_terms:
if this_term.startswith(term):
sys.stderr.write("\x1b]2;" + str(message) + "\x07")
sys.stderr.flush()
break

Funziona egregiamente, e fa rimpiangere un po’ meno l’assenza di Growl quando parto con Ubuntu.