Monday, May 30, 2011

HOW-TO: ifnconfig (HP-UX) as ifconfig (Linux)

To be able to see lan cards in HP-UX and its ip address similar as in Linux with ifconfig command, it is needed to make a little script:

1. make a new file:

vi /bin/lanshow

2. fill it with following data in it:

#!/bin/sh
netstat -ain | awk '$1 ~ /^lan/ && $1 !~ /:/ {print $1}' | sort | \
while read i
do
ifconfig $i
done

3. start it:

/bin/lanshow (or only lanshow)

Primer:
bash-4.2# /bin/lanshow
lan0: flags=2000000000001843
inet 192.168.1.1 netmask ffffff80 broadcast 192.168.1.255
lan1: flags=2000000000001843
inet 192.168.1.2 netmask ffffff80 broadcast 192.168.1.255



Friday, May 27, 2011

HOW-TO: Enable Appear Offline / Invisible in Office Communicator 2007

1. Open regedit (start -> run -> regedit)
2. Find location:
\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Communicator
3. Add REG_DWORD value (in case of Windows7 64bit, add a 32bit DWORD) with name
EnableAppearOffline
3. Set value to 1
4. stop and start Office Communicator

Wednesday, April 6, 2011

Capturing and replaying console/terminal sessions with script and scriptreplay

Have you ever wondered how you can easily capture a console session on Linux (and probably most other Unix-like OSes) without the need for special video recording software?

Here's how: you can use the script(1) command (part of the bsdutils package).

  • Start the script command. Without parameters the sessions will be logged to a file called typescript. You can also supply a filename on the command line: script mysession.log.
  • Type whatever you want to record...
  • End the recording session with exit or CTRL-d.
  • You can now view the file with less -r mysession.log (it contains line feeds, escape sequences etc., so a simple text viewer will probably display garbage). You can even print it with lpr(1). Or simply display it on the terminal with cat mysession.log.

An even cooler feature is that you can replay a script with the correct timing information:

  • First you have to also record the timing information using the -t switch: script -t 2>mysession.timing mysession.log.
  • You can then replay the script: scriptreplay mysession.timing mysession.log.

See the script(1) and scriptreplay(1) manpages for more details.

Sunday, April 3, 2011

VMware Tools installation cannot be started manually while Easy Install is in progress.

I created a Virtual Machine using VMWare's Workstation version 7. I did not install the tools right away, and I think that because of a hurry I really did not pay attention during the install, so I think I installed it using the simple mode, maybe not. Not that is bad doing it that way, but I never usually do it that way.

Whatever happened, later, when I went to install the tools, I got this message:
"VMware Tools installation cannot be started manually while Easy Install is in progress."

Now, I did not have time to do extensive research. One web site said something about the floppy drive config. I did find something referring to simple mode floppy, but removing it from the config file did not help.

Here is the quick simple way I fixed it: Delete the *.vmx config file. Then create a new machine but point it to the same folder. You will get a "warning" about creating a machine in the same folder as an existing machine, but no worry. Just make sure you use an "existing disk", and point it to the original.

This fixed it for me and it only took me a few minutes.

Tuesday, March 15, 2011

HOW-TO: Remove ILO2 license

You can remove license without reverting back to factory setting by logging into iLO2 using command line (telnet/secure shell) and execute command

"delete /map1 license"

Friday, March 4, 2011

HOW-TO: Mount a Windows share with smbmount

Make the directory you want to mount the share to.
mkdir /mnt/share
Next either...

Mount the share with user/pass:
smbmount //winpc/shared /mnt/share -o username=user,password=pass,rw
Or mount the share without a user/pass (this is true if Everyone is still set)
smbmount //winpc/shared /mnt/share -o rw
Hopefully thats it. Now you can use the share. You cannot create symbolic links or chmod the system (this is restriction on the WinXP side).

If you wish to allow users on the linux side access to the share then you will need to alter the options. Adding in uid= or gid= to allow access to users or groups respectively by mounting the drive with there permissions. Here's an example:
smbmount //winpc/shared /mnt/share -o rw,uid=znx
This will mount the drive as if user znx had done it. Thus he will have rw access to the shared.

Monday, February 28, 2011

How To scp, ssh and rsync without prompting for password

Whenever you need to use scp to copy files, it asks for passwords. Same with rsync as it (by default) uses ssh as well. Usually scp and rsync commands are used to transfer or backup files between known hosts or by the same user on both the hosts. It can get really annoying the password is asked every time. I even had the idea of writing an expect script to provide the password. Of course, I didn't. Instead I browsed for a solution and found it after quite some time. There are already a couple of links out there which talk about it. I am adding to it...

Lets say you want to copy between two hosts host_src and host_dest. host_src is the host where you would run the scp, ssh or rsyn command, irrespective of the direction of the file copy!

  1. On host_src, run this command as the user that runs scp/ssh/rsync

    $ ssh-keygen -t rsa

    This will prompt for a passphrase. Just press the enter key. It'll then generate an identification (private key) and a public key. Do not ever share the private key with anyone! ssh-keygen shows where it saved the public key. This is by default ~/.ssh/id_rsa.pub:

    Your public key has been saved in /.ssh/id_rsa.pub

  1. Transfer the id_rsa.pub file to host_dest by either ftp, scp, rsync or any other method.

  1. On host_dest, login as the remote user which you plan to use when you run scp, ssh or rsync on host_src.

  2. Copy the contents of id_rsa.pub to ~/.ssh/authorized_keys

    $ cat id_rsa.pub >>~/.ssh/authorized_keys
    $ chmod 700 ~/.ssh/authorized_keys

    If this file does not exists, then the above command will create it. Make sure you remove permission for others to read this file. If its a public key, why prevent others from reading this file? Probably, the owner of the key has distributed it to a few trusted users and has not placed any additional security measures to check if its really a trusted user.

  1. Note that ssh by default does not allow root to log in. This has to be explicitly enabled on host_dest. This can be done by editing /etc/ssh/sshd_config and changing the option of PermitRootLogin from no to yes. Don't forget to restart sshd so that it reads the modified config file. Do this only if you want to use the root login.

Well, thats it. Now you can run scp, ssh and rsync on host_src connecting to host_dest and it won't prompt for the password. Note that this will still prompt for the password if you are running the commands on host_dest connecting to host_src. You can reverse the steps above (generate the public key on host_dest and copy it to host_src) and you have a two way setup ready!

How to use DiskSpd to simulate Veeam Backup & Replication disk actions

This HOW-TO contains information on how to use Microsoft© DiskSpd to simulate Veeam Backup & Replication disk actions to measure disk pe...