Latest Event Updates

Select the default editor

Posted on Updated on

For the time being you might have came through a situation where you would like to change the default editor. For example, you want to open crontab using vi rather than using nano. Use the below command to select the default editor :


select-editor

eg:
root@test:~# select-editor 

Select an editor.  To change later, run 'select-editor'.
  1. /bin/ed
  2. /bin/nano        <---- easiest
  3. /usr/bin/vim.basic
  4. /usr/bin/vim.tiny

Choose 1-4 [2]: 3

Enjoy :)

Bash vulnerability

Posted on Updated on

A latest vulnerability in bash has been reported which affected more than 50% of the servers worldwide, using which attackers could run malicious code on the system. You can check whether your server is affected using the below command :

 env x='() { :;}; echo yes you are vulnerable' bash -c "echo testing finished"

If you get the output as

[root@test ~]#  env x='() { :;}; echo yes you are vulnerable' bash -c "echo testing finished"
yes you are vulnerable
testing finished

then you are affected. please update your bash to the latest one in CentOS as below:

yum update bash

If you are already patched to the latest bash, you will get the below reply :

[root@test ~]#  env x='() { :;}; echo yes you are vulnerable' bash -c "echo testing"
bash: warning: x: ignoring function definition attempt
bash: error importing function definition for `x'
testing finished

For other Distributions >>>>

Ubuntu 
10.04:
sudo apt-get --upgrade install bash
latest ubuntu distributions :
apt-get install --only-upgrade bash
Fedora :
Fedoar 19 :
sudo curl -O https://kojipkgs.fedoraproject.org//packages/bash/4.2.48/2.fc19/x86_64/bash-4.2.48-2.fc19.x86_64.rpm
rpm -U bash-4.2.48-2.fc19.x86_64.rpm

Fedoara 20:
sudo curl -O https://kojipkgs.fedoraproject.org//packages/bash/4.2.48/2.fc20/x86_64/bash-4.2.48-2.fc20.x86_64.rpm
sudo rpm -U bash-4.2.48-2.fc20.x86_64.rpm

simple but worthy to say :)

Ubuntu : eth0 not coming up on bootup

Posted on

You may have noticed that after the network edits, the eth0 is not coming up after restart and you have to make it up using the command :

ifup eth0

To start it up automatically after every restart, just add the below entry in your

 /etc/network/interfaces
auto lo eth0

Check whether the server is virtual or physical

Posted on

1. Install the package : facter
In centOS : yum install facter
In ubuntu : apt-get install facter
2. Run the command :

facter virtual

3. Check the output.

for example :

[root@test1 ~]# facter virtual
vmware
root@test2:~# facter virtual
physical

Thanks :)

Change the color of your terminal

Posted on

To change the color of the terminal :

tput setaf number

Use the below numbers for the corresponding color.

Black : 0
Red : 1
Green : 2
Yellow : 3
blue : 4
Magenta : 5
Cyan : 6
White : 7

Eg : For Green(my fav :)),

tput setaf 2

Enjoy :)

Import certificate and key into jks

Posted on

1. First create a p12 file and import both the certificate and key into it using openssl.

openssl pkcs12 -export -name theg -in /etc/ssl/certs/theg.crt -inkey /etc/ssl/private/theg.key -out theg.p12

2.Convert the p12 format into jks format using keytool :

keytool -importkeystore -destkeystore theg.jks -srckeystore theg.p12 -srcstoretype pkcs12 -alias theg

Note : Here I used the name theg for my certificates and alias, change it accordingly.

Set environment variable in ubuntu

Posted on

Add the required path in /etc/environment
update it using
source /etc/environment