Monday, December 08, 2014

create a new java keystore with existing cert

create a new java keystore with existing cert

openssl pkcs12 -export -in host.crt -inkey host.key > host.p12

# DO ENTER A PASSWORD

keytool -importkeystore -srckeystore host.p12 -destkeystore host.jks -srcstoretype pkcs12

Tuesday, May 20, 2014

debian make convert regular disk to lvm

1. Attach the new disk
2. create lvm
3. dd data from old to new lvm root
4. grub-install /dev/sdb (the new disk)
5. update-grub (in chroot or inside the actual OS)

Friday, May 16, 2014

allow other users in screen session / share screen session

1. sudo chmod +s /usr/bin/screen
2. sudo chmod 755 /usr/bin/screen
3. USER1: screen -S screen1
    USER1: CTRL+A :multiuser on
    USER1: CTRL+A: acladd USER2
4. USER2: screen -x USER1/screen1

set ubnutu linux default terminal encoding to UTF-8

gconftool --set --type=string /apps/gnome-terminal/profiles/Default/encoding UTF-8

Monday, May 12, 2014

debian squeeze change root disk to lvm

  1. create the lvm on the second disk
  2. dd data onto the lvm disk
  3. detach the old disk
  4. reboot with rescue cd and chown into the lvm root
  5. grub-install /dev/sda
  6. update-grub

Wednesday, April 30, 2014

X11 forwarding for other users

1. in Your session do xauth list and find your correct auth (the one matching $DISPLAY), and copy the whole line

2. do your sudo or su and then do xauth add <the line copied in step one>


Big Thanks to http://blog.cyphermox.net/2008/05/ssh-x11-forwarding-for-other-users.html

Thursday, April 10, 2014

add remove dynamic bind dns records

IF ZONES EXIST

nsupdate -k $keyfile
> server 127.0.0.1
> update add server1.example.com 3600 A 10.0.0.1
> send
> update add 1.0.0.10.in-addr.arpa 3600 in ptr server1.example.com.
> send

Wednesday, April 09, 2014

Friday, February 07, 2014

remove a line from a file

sed -i '22d' /root/.ssh/known_hosts


or better is to do ssh-keygen  -R hostname/IP

linux change root disk grub-install

redetect disks by grub-install in case dd ing 446 bytes from one disk to the other did not work, /boot/grub/devices.map needs to be fixed

Wednesday, February 05, 2014

perl command line arguments

#!/usr/bin/perl -w

use strict;
use Getopt::Long;
use utils qw( &usage );
my($host,$port,$user,$password,$file,$opt_w,$opt_c) = ("",22,"","","","","","","","");

Getopt::Long::Configure('bundling', 'no_ignore_case');
GetOptions
("H|host=s"     => \$host,
 "p|port=s"     => \$port,
 "U|user=s"     => \$user,
 "P|password=s" => \$password,
 "F|file=s"     => \$file,
 "w|warning=s"  => \$opt_w,
 "c|critical=s" => \$opt_c,
 );


($host) ||  usage("Host not specified\n");
($user) ||  usage("SFTP Username not specified\n");
($password) || usage("SFTP password not specified\n");
($file) ||  usage("File to upload and download not specified\n");
($opt_w) || usage("Warning threshold not specified\n");
($opt_c) || usage("Critical threshold not specified\n");

Tuesday, February 04, 2014

rvm install ruby specific version

\curl -k -sSL https://get.rvm.io | bash -s stable --ruby=1.9.3-p362

Monday, February 03, 2014

replace root with lvm

In rescue mode::

KER=`ls /lib/modules` #if single kernel
initrd -v -f /boot/initrd-$KER.img $KER

DAAA  :::: make sure you do not have rd_NO_LVM in the options passed to vmlinuz