Wednesday, September 10, 2014

How to Encrypt And Decrypt Files with GPG?

Linux: How To Encrypt And Decrypt Files With A Password in gpg?


T

o encrypt and decrypt files with a password,  you canuse gpg command. This is an encryption  tool for Linux/UNIX like operating system.

gnupg

GnuPG stands for GNU Privacy Guard.

Encrypting a file in linux

To encrypt a single file, 
$ gpg -c somefilename
It will prompt for password:
Enter passphrase:
Repeat passphrase:
This will create a somefilename.gpg file. Where,
  • -c : Encrypt with symmetric cipher using a passphrase. The default symmetric cipher used is CAST5, but may be chosen with the --cipher-algo option. This option may be combined with --sign (for a signed and symmetrically encrypted message), --encrypt (for a message that may be decrypted via a secret key or a passphrase), or --sign and --encrypt together (for a signed message that may be decrypted via a secret key or a passphrase).
Note that if you ever forgot your password (passphrase), you cannot recover the data as it use very strong encryption.

How to Decrypt a file

To decrypt file use the gpg command as follow:
$ gpg somefilename.gpg
gpg: CAST5 encrypted data
Enter passphrase:

Monday, September 8, 2014

How to check either string is present or not in TCL programming?



How to check either string is present or not in TCL programming?


Below is example to search xyz in long string let's say http://xyz.com/home/index.html
set variable_name http://xyz.com/home/index.html
if {![lsearch -regexp $variable_name xyz ]} {
puts " Not found"
exit 1
 } else {
puts "OK"
}

How to keep SSH session alive in PUTTY?



How to keep SSH session alive in putty utility?

Open putty-->goto Connection--> look for "Seconds between keepalives (write 30 seconds)

Enjoy !!!



Sunday, March 16, 2014

How to install and configure sendmail server in Linux?


The sendmail can be configured from  files in /etc/mail and a directory of configuration files in /usr/share/sendmail-cf. There are two basic configuration files:
  1. sendmail.cf The main sendmail configuration file.
  2. sendmail.mc A macro that's easier to edit, which can be used to generate a new sendmail.cf file.
In this example you can use two systems linux server , and linux clients.
  • A linux server with ip address 192.168.0.100 and hostname Server
  • A linux client with ip address 192.168.0.10 and hostname Client1
  • A Configured DNS server on Linux server and remember to set MX record
  • Updated /etc/hosts file on both linux system
  • Running portmap and xinetd services
  • Firewall (iptable) should be off for port 25 on server


Configure sendmail server

sendmail and m4 rpm are required to configure sendmail server

 sendmail rpm

Sendmail program reads the /etc/mail/sendmail.cf. Change the /etc/mail/sendmail.mc file. When Sendmail is started or restarted with the service sendmail restart command a new sendmail.cf file is automatically generated if sendmail.mc has been modified.

open /etc/mail/sendmail.mc for editing
vi /etc/mail/sendmail.conf


The following line limits sendmail access to connect local host only [line no 116]
sendmail.mc

 You can allow other computers to use your sendmail server by commenting out this line.

In the sendmail.mc file , lines that begin with dnl, which stands for delete to new line, are considered comments. Some lines end with dnl, but lines ending in dnl are not comments

comment this line with dnl keyword followed by # sign
sendmail.mc
save this file with :ZZ and exit.

Now generate new sendmail.cf file by using m4 command as shown here
m4


Run chkconfig so that sendmail server should start automatically after restart the server and start the sendmail service

 service sendmail restart
 

Testing of your sendmail server


  Create user abc
useradd abc
Add password
passwd abc

echo "BODY" | mail -s "Subject" abc
mail sent to abc user.

How to find which process is eating RAM memory in Linux Operting System?

ps aux | awk '$6 > 0{print $3, $4, $5, $6}'
or

ps aux | awk '{print $2, $4, $11}' | sort -k2r | head -n 20

Wednesday, July 3, 2013

Manager- A Self Killer

Manager- A Self Killer
 
This is my second blog on Manager and I hope you will also like it. In-case you are manager, you mayn't like it but it doesn't mean that i will not write on manager. Whatever my experience says, i just add and publish it through blog.

I met one Manager sorry right now he is not manager, he was manager few years ago but he still thinks he is manager, so don't mind we call him as manager let him keep happy.
 
He was handling a team of five-six people out which one person was not good from manager's prospective so at appraisal time, manager gave him "Performance needs improvement" and hike was just 5%, employee was not happy, every employee thinks he did well, I can understand How we can say we are not intelligent? We didn't work last year...... So after few months that employee had left the company for 30% hike, we know market is open, 0-5 years can get job at any moment.

Manager was happy, he opened a new opening but his bad luck, and there were job freeze in company for six months :(. He distributed the work to other four people. Other employees were tensed, but they tried to maintain it. Now second bad news for Manager, one more project had added to his portfolio, Oops!! one more resignation, When he asked to employee why you are leaving, he said because of work pressure.

Now he has three employees and triples the load, and because of freeze, he can't hire. After two months, two more resignations and he was not able to stop them.

After a month, Management asked him to be a part of existing team as only one person is reporting to him. Now he is doing coding, no managerial work at all.

This Manager is called - A Self Killer.

What he did wrong? He penalized employee. I ask a question, if your child does some mistake, what you do? Do you penalize him or teach him what to do? How to do? If you are good parents, you teach child softly.
So if your employee does some mistake never penalize him with less salary hike.

Tuesday, June 11, 2013

Manager Never Listens


Manager Never Listens

Is is true? I think YES. Manager never listens. Problem is manger thinks he reached at this position because of his right decisions in past. His mind always speaks about his success over his subordinate.
He feels happy when he sees people are coming with problems. And he thinks this is simple problem and can be solved anytime, his reaction is that he has understood correctly and solves the problem in minutes but after weeks of weeks he never reacts.

In my past 12 years of experience, What I realize that employess don't want to sit with their bosses because first reason "Manager Never Listens" and Second "Manager always speaks about his success".

Most of the time you realize that Managers are either very happy or very sad. They are never in-between. It means, they are not normal/natural, they are acting in their life. If they have some work from anyone, they start asking about  family members, their problems and so on... And as soon as work is done, their reaction is all together different. They think, no one should come to meet him. Because in their mind, second thing is running that work is done and people may ask for party or increment. So they always avoid meetings after work is done.

These days, even you go to manager and ask for more work their reaction is different, they start thinking, more work, more dependency, and more salary hike so to avoid this situation, they think better to say OK LET ME THINK or make a presentation WHAT ELSE YOU CAN DO . And these four/five words you can listen in all manager's cubical.