CirclingMinds

September 21, 2007

Useful Linux Commands

Filed under: linux — shovan @ 9:58 pm

Disk Usage

To find out disk usage in your linux box type:

df -h

Memory Usage

To get a breakdown of memory information, run

cat /proc/meminfo

To get a sum of memory(RAM) size, run

 cat /proc/meminfo | grep MemTotal

Process Details

To find details of processes that are running:

 ps -ef

You can also do

ps -ef | grep ruby

to look for any ruby processes that are running on the machine.

List of files in a directory

ls | wc -l

May 6, 2007

Public Key Authentication

Filed under: linux — shovan @ 9:59 pm

Using public key authentication you can save yourself the hassel of remembering and entering password everytime you try to connect to a remote server. This process requires two files: a private key and a public key that identifies the local machine and the remote host.  Lets get started.

Step 1:

Enter the following command on the local machine.

ssh-keygen -t dsa

It will ask you if you want to enter a pass phare. Ignore it.

That command creates two files

i) id_dsa : This is the private key
ii) id_dsa.pub : public key which you will copy to the remote host where u want to login using the public key authentication method
Step 2:

Copy the id_dsa.pub key to the remote host you want to access.

Step 3:

Log in to the remote host and add the id_dsa.pub file to the authorized_keys file which resides in your ~/.ssh/ directory. If the file and the directory does not exist then you have to create it.

Syntax for adding the public key (id_dsa.pub) to the authorized_keys file:

cat id_rsa.pub > authorized_keys

Now try logging into the remote host. You will notice that you no longer require password to get in. This is because your machine’s public key  is listed in the authorized_keys file that matches to your corresponding id_dsa private key that is located in your ~/.ssh folder.

May 5, 2007

How to setup synergy ( Mac OSX / Ubuntu)

Filed under: linux, mac-os-x — shovan @ 10:01 pm

With the help of Synergy one can manange multiple computers/screens by using just one keyboard and mouse. So i found out after several painful months of using two sets of keyboard and mouse to switch between my Macbook and Ubuntu Desktop. I shall talk about the steps I took to get synergy to work on my Macbook and Ubuntu desktop. I chose to use my Macbook as the server and Ubuntu as the client.

Hostname of my Macbook(Server): isis
Hostname of my Ubuntu Desktop(Client) : venus
Please replace the hostnames in the following example with your correct names.

Step 1.
Download and install the source code from http://synergy2.sourceforge.net/
unzip the file install it on both computers.

./configure
make
sudo make install

Step 2 ( Configure Mac OS X server)
create a file called synergy.conf with the following content

section:  screens
# name the screens
isis:
venus:
end
 
section:  links
# telling synergy direction of the screens
# my macbook is on the left and Ubuntu is on the right
isis:
right = venus
venus:
left = isis
end

to start the synergy server

synergys -f --config syngery.conf

Step 3: ( starting Ubuntu Client)
Make sure you have installed synergy.Then run the following command.

synergyc -f isis
(syngergyc -f hostname-of-synergy-server)

You can also use the ip address of the synergy server.

For more information visit: http://synergy2.sourceforge.net/faq.html

March 9, 2007

VNCServer Problems

Filed under: linux — shovan @ 9:39 pm

If you are having problems accessing a machine which has vncserver running, then you should check if the firewall is blocking the port.

Normally you will get the following error if the remote host is reachable but the port to vncserver is blocked.

Exception connecting to hostname: Connection refused

You can try the following steps to open the port for Vncserver.

Step 1:
There are several ways to open up port for vncserver. One way is to edit the iptables.

$su
$cd /etc/sysconfig
$vi iptables

Step 2:

Insert the following line

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901:5909 -j ACCEPT

right before the second last line

-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT

Step 3:
The next step would be to restart iptables.

# /sbin/service iptables restart

Now the machine (host) with the vncserver should be accessible from remote computers which has vncviewer installed.

To start vncserver:

vncserver -geometry 1024x768

Powered by WordPress