TheBoox(Idea)

January 24, 2012

ssh-keygen how to

Filed under: linux — Tags: — admin @ 11:57 am

how to create private and public keys for your linux or Mac (Tired of password? )

>ssh-keygen -t rsa
/home/yourname/.ssh/id_rsa (private key) (just press Enter)
Enter passphrase (just press Enter)
nter same passphrase again: (just press Enter)

you will get private key (id_rsa) and public key id_rsa.pub under /home/yourname/.ssh/

scp id_rsa.pub to your remote machine under /home/new_machine/.ssh (if you do not see directory .ssh, just create it)
then cat id_rsa.pub to /home/new_machine/.ssh/authorized_keys (if you do not see file authorized_keys, just create it)

cat id_rsa.pub >> authorized_keys

done!

note: you never send your private key to someone, you only send your public key to someone

January 23, 2012

install javac in debian ( cat /etc/issue Debian GNU/Linux 5.0 )

Filed under: Java — Tags: — admin @ 10:22 pm

here is how
apt-get install sun-java6-jdk sun-java6-source sun-java6-bin sun-java6-plugin sun-java6-jre

January 8, 2012

send email when someone login to the shell,

Filed under: linux command — Tags: — admin @ 7:10 pm

here is the simple script to send you email when someone login to the shell.

echo ‘ALERT – Root Shell Access on:’ `date` `who` | mail -s “Alert: Root Access from `who | cut -d”(” -f2 | cut -d”)” -f1 `” name@gmail.com

ubuntu apt-get install java, how to install java in ubuntu/debian

Filed under: Java — Tags: — admin @ 6:39 pm

install java in ubuntu or debian
>sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

December 16, 2011

grant user to database [mysql]

Filed under: mysql — Tags: — admin @ 5:45 pm

login as root in mysql:
assume you want to grant new_user to use new_db
> use new_db
> grant all privileges on new_db to ‘new_user’@'localhost’ identified by ‘new_user_pass’;
> flush privileges

if you just create new user in mysql server, you need to grant the new user permission from root account
>GRANT ALL PRIVILEGES ON *.* TO ‘new_user’@'localhost’ WITH GRANT OPTION

December 15, 2011

ubuntun/debian add user

Filed under: linux command — Tags: — admin @ 11:32 pm

sudo adduser -d /home/new_user -m new_user
sudo passwd new_user

December 14, 2011

mysql add column with default value

Filed under: mysql — Tags: — admin @ 2:59 am

ALTER TABLE table_name ADD new_col INT NOT NULL DEFAULT 0

November 17, 2011

gdb set conditional breakpoint C++

Filed under: gdb — Tags: , , — admin @ 10:54 pm

e.g
b myfile.cpp:128 if rsize > 0

vim set file really readonly

Filed under: Vim — Tags: — admin @ 9:15 pm

:set nomodifiable

November 12, 2011

Ubuntu won’t connect to internet on vmware in winxp

Filed under: vmware — Tags: — admin @ 2:29 am

here is how to fix it.(for windowxp), I think it work on other OS

1) go to “run”
2) type services.msc Enter

on the services window:
3) find “VMware NAT Service”
4) and restart it, and reboot your vmware

Older Posts »

Powered by WordPress