Saturday, February 13, 2010

Generate multiple keys and password less logins

Generate multiple keys and password less logins

Step # 1: Generate first ssh key

Type the following command to generate your first public and private key on a local localmachine. Next provide the required input or accept the defaults. Please do not change the filename and directory location.


localmachine#1 $ ssh-keygen -t rsa

Finally, copy your public key to your remote server using scp
localmachine#1 $ scp ~/.ssh/id_rsa.pub user@server:.ssh/authorized_keys
Step # 2: Generate next/multiple ssh key

a) Login to 2nd localmachine

b) Download original the authorized_keys file from remote server using scp:
localmachine#2 $ scp user@server:.ssh/authorized_keys ~/.ssh

c) Now create the new pub/private key:
localmachine#2 $ ssh-keygen -t rsa

d) Now you have new public key. APPEND this key to the downloaded authorized_keys file using cat command:
localmachine#2 $ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

e) Finally upload authorized_keys to remote server again:
localmachine#2 $ scp ~/.ssh/authorized_keys user@server:.ssh/

You can repeat step #2 for each user or localmachines for remote server.
Step #3: Test your setup

Now try to login from localmachine #1, #2 and so on to remote server. You should not be asked for a password:
localmachine#1 $ ssh user@server
localmachine#2 $ ssh user@server

Tuesday, February 9, 2010

How to check file system of windows virtuozzo container vps chkdsk for virtuozzo windows

Windows virtuozzo crashing very often. After checking the event viewer found this.

One of the last errors it gave in the event viewer was: "Faulting application svchost.exe, version 5.2.3790.3959, faulting module unknown, version 0.0.0.0, fault address 0x01aef4b6." I am not seeing a direct reason from Microsoft as to the reason for this. This error message was found under "System" in event viewer: "The file system structure on the disk is corrupt and unusable. Please run the chkdsk utility on the volume \Device\VZLPBKVolumes\VZLPBKVolume{553ba7dd-451e...." Please let us know if we can assist you further with this.

refer this http://kb.parallels.com/en/1008

To find the GUID

c:>vzcfgt get 114 GUID

This gives you the GUID or you can run this bat file

make a bat file

===============================
@echo off
for /F "skip=3 usebackq tokens=*" %%i in (`cmd /c "vzlist -ao veid"`) do (cmd /c "vzcfgt get %%i GUID" && echo is GUID of VE %%i)
pause

===============================

Now run these commands at the command prompt to do the chkdsk for the windows container

vzctl stop 157
vzdskctl mount c:\vz\private\157\root.efd {553ba7dd-451e-4969-b231-397442baaa32}

chkdsk /f \\?\Volume{553ba7dd-451e-4969-b231-397442baaa32}

vzdskctl umount {553ba7dd-451e-4969-b231-397442baaa32}
vzctl start 157




vzdskctl mount c:\vz\private\596\root.efd {222c9735-95b2-4e41-98ef-b9f4181eb8dc}