Let's make the world a better place using digital technologies!

Category: Windows

SSH into Linux server from Windows using Putty

Follow these steps:

  1. Login to the Linux server using login/password and go to the home directory of the user:
    cd ~
  2. Generate the ssh key of type dsa using:
    ssh-keygen -t dsa
    Do not forget to enter a strong passphrase for your identity keys. It is not a good idea to leave it blank. You can later use pageant-like software and may not have to retype the key every time you want to login to remote host. Name the keys according to your choice (keyname).
  3. Copy the public key to authorized_keys:
    cat keyname.pub >> authorized_keys
  4. Set appropriate permissions:
    chmod 600 authorized_keys
    chmod 700 ../.ssh
  5. Copy the private key to windows machine either manually using a usb stick, etc. or through a secure channel like ssh/scp/sftp, etc. You may use WinSCP for this purpose. There is a post on this blog on how to use WinSCP.
  6. Convert the private key file (keyname) using PuttyGen tool to putty format (keyname.ppk). Save the original private key and this Putty-generated key to a secure location on your Windows machine.
  7. In Putty, under Connection->SSH->Auth, enter the location of your .ppk file. Connect to the Linux host using Putty. That is all to it.
Continue Reading

GUI-Based Secure File Transfer Using ssh

I have written a post some time ago about transferring files between linux and windows pc over ssh using pscp utility. I just found out that a much better and GUI way, on windows side, is to use WinSCP. It is a handly utility that offers very user friendly (norton commander like) interface to tranfer files around.

Continue Reading
Continue Reading

Checking Memory Leaks in Visual Studio C/C++ Programs

Add the following to the top of the file containing main function:
#include <stdlib.h>
#include <crtdbg.h>

Add following line before the end of the main function, or wherever the main can return:

Compile as debug and execute. Memory leaks will be printed on the output window which can be clicked to point the problem location.

Continue Reading

Batch Resizing of Images using Adobe Photoshop

In Adobe Photoshop:
File->Scripts->Image Processor

  • Select the source folder where the pictures are located.
  • Select the destination folder where the pictures will be stored after resizing.
  • Click Run to start batch processing.
Continue Reading

Increasing the disk size in andLinux

  1. Stop the andLinux service and make sure no colinux daemon is running.
  2. Download dd for windows and put in the same folder as base.drv or wherever your “/” drive image is located.
  3. The following command extends a 4 GB partition to 16 GB:
    dd bs=16384 if=/dev/zero of=base.drv seek=262144 count=786432
  4. The seek=262144 tells dd that it should start filling zeros starting from this address which is the size of your 4GB image divided by 16384. In my case it is
    4294967296/16384=262144 number of 16K blocks.
  5. The count=786432 tells dd that it should fill 12GB of zeros. This is just (1024)^3/16384 number of blocks.
  6. After it has increased the file size, start the andLinux service and at the command prompt in Linux, type the following:
    apt-get install ext2resize
    ext2online /dev/cobd0
  7. Now you should have the new expanded hard disk image. To check, type:
    at the command prompt and you will see that /dev/cobd0 is now new size.
Continue Reading

andLinux Error: “cannot connect to X server”

If you encounter this error, you should check the following:

  • that the given IP address, which indicates your display, is reachable, either using ping, telnet, or some other approach
  • that Xming.exe is running. You can check it using Windows Task Manager.
  • If everything seems working, then you may try killing the Xming.exe from Task Manager and restarting it using the following command:
    <PATH-TO>\Xming.exe :0 -dpi 85 -clipboard -notrayicon -c -multiwindow -reset -terminate -unixkill -logfile Xming.log
    It solved this problem for me.
Continue Reading

Solving: Samba not working in andLinux with domain users

If Samba share fails to mount during boot-up and you are a domain user, do the following:

  1. Edit /etc/smbpasswd
  2. Change the first line to username = <Domain>/<Username>. e.g., devel-net/andy
  3. The password in the second line should be the domain password

Now restart the andLinux service. The share should mount okay.

Continue Reading

Cygwin Installation

Step followed:

  1. Download and run Cygwin setup.
  2. Select Unix/Binary file types during installation.
  3. Select appropriate development packages, at least the gcc, make, automake, and autoconf.
  4. In Editors, choose emacs if you like to use it.
  5. Install ruby. You will need it for Terminator, a GPL terminal emulator.
  6. Complete the Cygwin installation. It will take some time until it downloads and installs the required packages.
  7. Go to My Computer -> right click -> Properties -> Advanced(tab) -> Environment Variables and create a new system-wide variable named “CYGWIN”. Give it the value “ntsec tty”. ntsec is for file permissions, and tty is needed for emacs to function properly.
  8. Edit the PATH variable in the Environment Variables and add “C:\Cygwin\bin”, assuming it is the correction Cygwin location.
  9. When you first get into the Cygwin, type the following commands to make appropriate passwd and group files:
    mkpasswd -l -c > /etc/passwd
    mkgroup -l -d > /etc/group
  10. Download and install Terminator. You have desktop icon as well but it does not work for me. So, if this is also the case for you, enter terminator at the command prompt. You shall have terminator running.

This installs a basic cygwin system with a decent terminal in the form of Terminator.

Continue Reading

Cygwin Installation: mkpasswd and mkgroup issue

You get this message when you start Cygwin:

Your group is currently “mkpasswd”. This indicates that
the /etc/passwd (and possibly /etc/group) files should be rebuilt.
See the man pages for mkpasswd and mkgroup then, for example, run
mkpasswd -l [-d] > /etc/passwd
mkgroup -l [-d] > /etc/group
Note that the -d switch is necessary for domain users.

Issue the following commands to fix it:

mkpasswd -l -c > /etc/passwd

mkgroup -l -d > /etc/group

It will create a local user based on the current logged on user. The groups will be fetched from the domain. For the local installation the “-d” option can be omitted from mkgroup command.

Thanks to sinewalker for this tip.

Continue Reading