Saturday, 29 November 2008

man pages under Cygwin

If man returns the error message Warning: cannot open configuration file /usr/share/misc/man.conf, then check that C:\cygwin\usr\share contains file man.conf. If this is missing, run /etc/postinstall/man.sh.

Saturday, 22 November 2008

Using rsh to enter commands on a Unix server

This entry explians how to allow a user on a client machine (in my case, Cygwin on Windows) to enter commands on a Unix machine as though the user were actually in front of the Unix machine. Furthermore, the mechanism used below does not require a password to be entered so it is useful in a scripting environment.

The process works because the server has a public key and the client has a private key. The server will not allow the logon if the client does not have an authorised private key to match its public key.

  1. Ensure that the rsshd daemon is running on the server. This article does not cover this.
  2. On the client, create the public/private key pair. Following is the console log:
  3. bash-3.2$ ssh-keygen -t rsa
    Generating public/private rsa key pair.
    Enter file in which to save the key (/cygdrive/c/Users/adrian/.ssh/id_rsa):
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /cygdrive/c/Users/adrian/.ssh/id_rsa.
    Your public key has been saved in /cygdrive/c/Users/adrian/.ssh/id_rsa.pub.
    The key fingerprint is:
    9f:4b:a6:81:dd:0b:09:06:73:b0:ec:c8:4c:05:17:89 adrian@AGW10
    The key's randomart image is:
    [some pretty artwork]
    bash-3.2$
  4. Transfer the content of the id_rsa.pub file (a single line) to $HOME/.ssh/authorized_keys (where $HOME is the home directory for the user which you will be logging on as). If $HOME/.ssh/authorized_keys already contains lines, append the new line to the end of it. The line will look something like:
    ssh–rsa AAAABAAAAAAAAAAAAAABIwAAAQEApFUflYKxxephdjteZtcHI+9jl6vkfFIp7WKB1pL2UrGqOfFlr4FVhA9XcuOsPwVXTOdOWMgaUCkfq2H36Zv1iLN93jyQ4YkS2Bx0wIpSVxb/m1E8AcAeJ2ma94y+rbHLu5TI3bTv3MNFJwxJBNnBeFZ2ISVNAA6RgnYAD1H2E3y8vPUesQsdOkKtpfDD3WjUDJIx1xgXVZI4YSrlp7WzHUFtoq7mCYucnELhkwOJjSFd9u3pjSt0V/7qr+DFYu5SwsFj4X88NYF96nLjjIG1BzaVsvBdgrCtKhrNq2j3cBWz59JOyuVSOYXw4Ouluk2Q0TsvgmANz63jlWOrxWCqGw== adrian@AGW10
  5. Now, when you enter
    ssh -b AGW12 root@AGW12
    in Cygwin, you will be running on machine AGW12.

Friday, 14 November 2008

Mounting Windows share on Linux

mount -t cifs //host/sharename /mnt/dir -o username=winuser,password=winpw,uid=lxuser,gid=lxgrp