Use Windows In the Spirit of Linux (3)

OK, Let’s get to the exciting things we can do with Windows and free/open source software.


The gnu emacs official site has a pre built binary of nt emacs, I downloaded it, but it will hang when I start it. The reason is I put cygwin into my PATH environment variable, and emacs will try to load the libjpeg6, libpng12 etc in the cygwin installation. But these .dll files are of wrong "format" — so to speak — for emacs, so it hung.

To solve this issue, I downloaded the libraries from the gnuw32 project on, and put them into the bin dir with emacs.exe

I got no idea why emacs will hang for quite some long time, but then I came across the image support in emacs and tried to make it work, and realized that this is the reason why emacs hung.

Emacs also comes with cygwin, but it requires X server, and when I last used it, it was not very stable, so I let go this version of emacs.

SSH Tools

I have been using ssh since a long long time ago, but I never knew that ssh includes a family of tools such as ssh-keygen, ssh-agent, and ssh-add.

With these tools, you can avoid inputting your password every time you open a new ssh connection to a sshd server. Which is quite boring (if you know that there’s another way). Also, you can avoid inputting password by writing it into a file, and use expect(1) to automate login, but that should be considered a security leak.

  1. Use ssh-keygen to generate a key, transfer and rename the public key to the server ~/.sshd/authorized_keys
  2. Run ssh-agent and ssh-add when I login. (It was written in a .bat file in ~/Start Menu/Programs/Startup, so it will automatically start and wait for my once and only once password input)
  3. the ssh-agent output is redirected to a file, and I source it in my ~/.bashrc.

Tramp allow you to open files on remote hosts using ssh/scp etc. programs, but the cygwin version of ssh won’t work easily (actually, it’s very difficult, IMHO). Luckily, we have another free software:

Putty Tools

Putty is also a family of tools, including putty (the terminal?), pageant (ssh-agent counterpart), plink (ssh parallel) and pscp (scp counterpart).

I also had a problem using these tools with tramp, that is, when used with tramp, my plink/pscp will require me to input password every time even I have pageant started. I downloaded the source and debugged it, and found out that it’s because pageant considers itself to be of different user/permission with the requesting plink/pscp, because they are started differently: pageant is started by the windows explorer, while plink/pscp is started by cygwin (I set shell-file-name to cygwin bash in my .emacs). Obviously cygwin did some screwing with the user permission thing. The solution is to start pageant with cygwin too.

To be Continued

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: