Wednesday, 28 December 2016

How to check swappiness value on Linux Box.



[root@sankar-test ~]# cat /proc/sys/vm/swappiness
60 -- default value



FYI,
swappiness can have a value of between 0 and 100

swappiness=0 tells the kernel to avoid swapping processes out of physical memory for as long as possible

swappiness=1 tells the kernel to Minimum swappiness without disabling it entirely

swappiness=100 tells the kernel to aggressively swap processes out of physical memory and move them to swap cache

swappiness=60
(default) the swap file will be used fairly often if the memory usage is around half of my RAM.

Wednesday, 21 December 2016

NFS Service Error(Starting NFS quotas: Cannot register service:..)

[root@sankar-test ~]# service nfs status
rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped

[root@sankar-test ~]# service nfs start
Starting NFS services:  [  OK  ]
Starting NFS quotas: Cannot register service: RPC: Unable to receive; errno = Connection refused
rpc.rquotad: unable to register (RQUOTAPROG, RQUOTAVERS, udp).
[FAILED]
Starting NFS daemon:

[1]+  Stopped                 service nfs start

[root@sankar-test ~]# service rpcbind status
rpcbind: unrecognized service

[root@sankar-test ~]# service portmap status
portmap is stopped

[root@sankar-test~]# service portmap start
Starting portmap: [  OK  ]

[root@sankar-test ~]# service nfs start
Starting NFS services:  [  OK  ]
Starting NFS quotas: [  OK  ]
Starting NFS daemon: [  OK  ]
Starting NFS mountd: [  OK  ]
Starting RPC idmapd: [  OK  ]
[root@sankar-test ~]#

Tuesday, 20 December 2016

PGP installation Steps on Linux

$ pwd
/home/zhsuasp

-bash-4.1$ gpg --gen-key
gpg (GnuPG) 2.0.14; Copyright (C) 2009 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
Requested keysize is 2048 bits
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y

GnuPG needs to construct a user ID to identify your key.

Real name: zhsuasp
Email address: nocinf@thelinuxstuff.com
Comment: Drinkfinity-PepsiCo
You selected this USER-ID:
    "zhsuasp (Drinkfinity-PepsiCo) <nocinf@thelinuxstuff.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.

==================================== error =====================================
Real name: NOC
Name must be at least 5 characters long
Real name: Drinkfinity
Email address: nocinf@thelinuxstuff.com
Comment: Drinkfinity-PepsiCo
You selected this USER-ID:
    "Drink (DrinkPepCo) <nocinf@thelinuxstuff.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
You need a Passphrase to protect your secret key.

can't connect to `/home/zhsuasp/.gnupg/S.gpg-agent': No such file or directory
gpg-agent[60524]: command get_passphrase failed: Operation cancelled
gpg: cancelled by user
gpg: Key generation canceled.
============================================================================
-bash-4.1$ export GPG_TTY=/dev/tty
-bash-4.1$ gpg --gen-key
-------------------------------------
-------------------------------------


                                                        +-----------------------------------------------------+
                                                        | Enter passphrase                                    |
                                                        |                                                     |
                                                        |                                                     |
                                                        | Passphrase *******_________________________________ |
                                                        |                                                     |
                                                        |       <OK>                             <Cancel>     |
                                                        +-----------------------------------------------------+





                                                 +--------------------------------------------------------------------+
                                                 | Warning: You have entered an insecure passphrase.                  |
                                                 | A passphrase should be at least 8 characters long.                 |
                                                 |                                                                    |
                                                 | <Take this one anyway>                      <Enter new passphrase> |
                                                 +--------------------------------------------------------------------+








                                                 +--------------------------------------------------------------------+
                                                 | Warning: You have entered an insecure passphrase.                  |
                                                 | A passphrase should contain at least 1 digit or                    |
                                                 | special character.                                                 |
                                                 |                                                                    |
                                                 | <Take this one anyway>                      <Enter new passphrase> |
                                                 +--------------------------------------------------------------------+






                                                        +-----------------------------------------------------+
                                                        | Please re-enter this passphrase                     |
                                                        |                                                     |
                                                        | Passphrase *******_________________________________ |
                                                        |                                                     |
                                                        |       <OK>                             <Cancel>     |
                                                        +-----------------------------------------------------+


We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: key 2FF6EEA2 marked as ultimately trusted
public and secret key created and signed.

gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
pub   2048R/2FF6EEA2 2016-12-20
      Key fingerprint = 47BF 878C B758 E3A3 AC30  1E94 56B3 BE4C 2FF6 EEA2
uid                  zhsuasp (Drinkfinity-PepsiCo) <nocinf@thelinuxstuff.com>
sub   2048R/095B75BE 2016-12-20

You have new mail in /var/spool/mail/zhsuasp
-bash-4.1$

======================
gpg --export ${ID} > public.key
gpg --export-secret-key ${ID} > private.key
Move files to new machine, and then:

gpg --import public.key
gpg: nyckel [ID]: public key [Name, e-mail] was imported
gpg: Total number of treated keys: 1
gpg:                 imported: 1  (RSA: 1)

gpg --allow-secret-key-import private.key
sec  [?]/[ID] [Creation date] [Name, e-mail]
ssb  [?]/[SUB-ID] [Creation date]
All looks good to me, but then:

$ gpg -d [file].gpg
gpg: encrypted with 4096-bit RSA-key, id [SUB-ID], created [Creation date]
  [Name, e-mail]
gpg: decryption failed: secret key not accessible
=========================================

gpg --output Dkfinity_pub.gpg --armor --export 2FF6EEA2

[sankar@localhost ~]$ gpg --import Dkfinity_pub.gpg
gpg: key 2FF6EEA2: public key "zhsuasp (Dkfinity) <nocinf@thelinuxstuff.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
[sankar@localhost ~]$ echo $?
0
[sankar@localhost ~]$ gpg -k
/home/sankar/.gnupg/pubring.gpg
-------------------------------
pub   2048R/2FF6EEA2 2016-12-20
uid                  zhsuasp (Dkfinity) <nocinf@thelinuxstuff.com>
sub   2048R/095B75BE 2016-12-20


$gpg -e -r zhsuasp result1.txt   (encryption)