Monday, October 17, 2011

SSH without password

Use ssh to move between linux/unix servers without entering password each time.

Perform dsa key exchange once and hop around in btween two unix/linux servers without entering passwd each time.

Actions to perform :
1: run the attached shell script in the local server
ex : user neeraj in server server1

2: Enter data as asked on the command line. Enter target server name and passwd when asked.

3: Message displayed : " echo dsa kay exchange successfully done"

4: Done, check the new setting by typing command from local server: ssh target_server_name.


***********************************************
#!/bin/sh

# check if the key file exists in the home location in local server

file_count=`ls -l $HOME/.ssh/ | grep id | wc -l`

if [ $file_count -eq 0 ]
then
ssh-keygen -t dsa

fi

#secure the contents of the .ssh directory by by removing read write permission from group and others.

chmod go-x $HOME
chmod go-rwx $HOME/.ssh
chmod go-rwx $HOME/.ssh/*


#copy the file to remote server
echo enter target machine hostname
read target
current_user=`whoami`

echo enter password of $target server
scp $HOME/.ssh/id_dsa.pub $whoami@$target:/tmp

echo again enter the passwd for the server $target

#append the content of public key to authorized_keys2 file

ssh $current_user@$target 'cat /tmp/id_dsa.pub >> $HOME/.ssh/authorized_keys2 '

ssh $target chmod go-w $HOME
ssh $target chmod 700 $HOME/.ssh
ssh $target chmod go-rwx $HOME/.ssh/*

ssh $target rm /tmp/id_dsa.pub


echo dsa kay exchange successfully done.


***************************************************************************

Thursday, July 14, 2011

UNFCC : Small view

This is international treaty which tries to achieve ways to reduce global warming and ways to cope up with inevitable global warming.

Its sub-part is Kyoto Protocol which is legally binding in nature. Kyoto protocol has provisions for binding targets for 37 industrialized countries.

Target decided is 5% of 1990 level in period 2008-2012. The idea is to solve the common problem in differentiated manner.

Mechanism identified :

1: Emission trading
2: CDM : clean development mechanism
3: Joint implementation

What is emission trading?

Parties of Annex B have accepted to reduce limit their emission . Allowed emissions are divided into " Assigned Amount Units " . One country can sell excess capacity to countries that are above their targets.

Other trading units :

1: Removable units : Land usage change and forestry

2: ERU : Emission Reduction Unit ( by JI )

3: CER : Certified emission reduction ( CDM )

Joint Implementation ( JI ) :
track 1 : Host fulfills all requirements
track 2: If host party meets limited set of eligibility


Clean Development Mechanism ( CDM ) : Emission reduction project in developing countries to earn CER credits.

Examples
1: Rural electrification Project using Solar panel

2: Installation of energy Efficiency boilers

IMF : Short view

Here are few points about IMF i did understand

IMF was established with objective of looking into global financial system by looking into macroeconomic policies of its member countries. Headquartered at Washington D.C . IMF tries to stabilize exchange rates.

Some reform talks are underway these days

1: 6% voting shares to major developing nations. Industrialized countries hold 57% of the vote share.

Criticism :

1: IMF is reflecting interests of western financial community

2: It works of assumption that all payment disequilibrium are caused domestically .

3: IMF advocates austerity , which can not be good option in all the economies .

4: Widely differing economic circumstances for different counties. IMF has failed over the years to see this reality as it tried to implement it policies.

Negative impact has been observed in following areas due to IMF negative policies

1: Impact on food

2: Impact on Health . IMF has prevented investment in areas of health as it forces the countries to look into short term balance. It also advocates fiscal restraint leading to neglect of Health sector.

3: Impact on environment

Wednesday, July 13, 2011

Public Admistration : My favourite lines

I was going through one book on public administration theories. I did come across some beautiful lines . There are so many lines , here i try to get at least few of them at this location . Here it goes ....

1: The accumulation of data through acceptable techniques does not alone give us adequate knowledge. Knowledge becomes critical and reliable as it increases in generality and internally consistent organization , when , in short , it is cast in the form of systematic generalised statements applicable to large number of particular cases.

2: Economists , for instance , tend to deal with how organizations allocate resources and how decisions are made under conditions of uncertainty. Industrial engineers focus on technological underpinning of organizational activities . Sociologists have have been concerned mainly with structure of organizations and ways in which organizations try to cope up with external environment. Psychologists have been interested in the behaviour of individual and group within organization . Issues of power and authority have attracted attention of political scientists .

3: When coercion is the basis of authority , compliance is alienated ; when remuneration is the basis of authority , compliance takes a calculative turn ; when authority base is normative ( expressed through persuasion ) , compliance is moral .

4: Focus of scientific management is narrow , as it essentially concentrated on the work done at lowest level in the organization .

5: Organizations grow more stupid as years roll by , since executives select subordinates who are less smart then themselves with a view to preventing their potential rivals.

6: Managers tend to be promoted until they reach to level of their incompetence.

7: POSDCORB : planning , organizing , staffing , directing , co-ordinating , reporting , budgeting

Thursday, July 7, 2011

Generating multiple records : Using python

Python code :
“””
filename : gprs.py
“””
import csv
start_time=csv.reader(open("start time.csv") , delimiter=' ' , quotechar='|')
"""
contains start timestamps
"""
end_time=csv.reader(open("end time.csv") , delimiter=' ' , quotechar='|')
"""
contains end timestamps

"""
"""
500 records are to be generated in single file

Name of output file is : gprs_500_records.txt
"""

for i in range(500) :
x=start_time.next()
y=end_time.next()
w=csv.writer(open("gprs_500_records"+".txt",'ab') , delimiter=' ' ,quotechar=' ' )
w.writerow([ 'unchanged part'+'|'+str(x[0])+'|'+str(x[0])+'|'+str(y[0])+'unchanged part'])
print "\n"


Note : This code can act as base code for situations where we need to generate multiple files/part of file. In this case we can store 500 records in one file only or into 500 separate files. So it depends on requirement. As we observe in this case Timestamp is variable, the variable data can be username in other scenario.

Tuesday, June 28, 2011

NSG : Nuclear suppliers group

Found in year 1974

NSG is group of nuclear supplier countries which which seek to achieve nuclear non-proliferation by implementing guidelines for Nuclear exports and nuclear related products export.

Wednesday, June 22, 2011

PSLV

PSLV : Polar satellite launch vehicle

PSLV is Scheduled to carry first communication satellite GSAT-12 in month of July . Traditionally it is known for carrying remote sensing satellite , Klapana-1 being one of them .

Note : Open for update

My Notebook

ANother thread starts, a new beginning . This time with technical stuff which will be visible to me only :)