Friday, December 12, 2014

Mutt# How to sort emails in descending order

Just add the below line in the ~/.muttrc file

# Sorting order
set sort = reverse-date-received

Restart the mutt !! Voila !

Monday, December 8, 2014

Kali Live Image password

In case anybody wondering what is the root password for Kali linux while booted from a live image ( cd / USB) it is 'toor' ( without quotes )

How to Deny / Allow user for Cron Job Access

If the /etc/cron.allow file exists, then you must be listed (one user per line) therein in order to be allowed to use this command.

If the /etc/cron.allow file does not exist but the /etc/cron.deny file does exist, then you must not be listed in the /etc/cron.deny file in order to use this
command.

<Scenario when user invisible is not in allow list, or appears in deny list>
$ crontab -e
You (invisible) are not allowed to use this program (crontab)
See crontab(1) for more information



Observation

If both the file exists, and same user appears in both cron.allow and cron.deny files, then user will able to edit crontab file.

If both the file exists, and same user doesn't appear in any of  cron.allow and cron.deny files, then user will not able to edit crontab file.

Note: Make sure to create an entry for the user in /etc/shadow file else user will not have the crontab operation ability. By default we have this entry made with adduser command.

Saturday, December 6, 2014

Installing Strace in a Debian Machine

Approach A
sudo apt-get install strace >> didn't work.


Approach B

Download the tar installer file from below location (assuming download location is ~/Downloads)

http://sourceforge.net/projects/strace/

Then run the below commands

root@sincity:~/Downloads# ls
strace-4.9.tar.xz
root@sincity:~/Downloads# tar -Jxf strace-4.9.tar.xz
root@sincity:~/Downloads# ls
strace-4.9  strace-4.9.tar.xz
root@sincity:~/Downloads# cd strace-4.9

root@sincity:~/Downloads/strace-4.9# ./configure

root@sincity:~/Downloads/strace-4.9# make

root@sincity:~/Downloads/strace-4.9# make install
root@sincity:~/Downloads/strace-4.9# strace -V
strace -- version 4.9

Friday, December 5, 2014

vim editor setup

#update the .vimrc (~/) with the following lines to enable coding style editing.

filetype plugin indent on
syn on se title
set tabstop=8
set softtabstop=8
set shiftwidth=8
set noexpandtab



Setting VIM up as default editor >> Make sure /usr/bin/vim.basic is selected.


root@sincity:~# sudo update-alternatives --config editor
There are 6 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/vim.gtk     50        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode 
  3            /usr/bin/mcedit      25        manual mode
* 4            /usr/bin/vim.basic   30        manual mode
  5            /usr/bin/vim.gtk     50        manual mode
  6            /usr/bin/vim.tiny    10        manual mode

Press enter to keep the current choice[*], or type selection number: >> 4

Configuring Mutt for Google Mail / IMAP / SMTP

### Sample MuttRC file (working condition) for gmail users

root@sincity:~# pwd
/root
root@sincity:~# ls -ltr .muttrc
-rw------- 1 root root 1201 Dec  3 10:00 .muttrc
root@sincity:~# cat .muttrc
set folder      = imaps://imap.gmail.com/
set imap_user   = myemail@gmail.com
set imap_pass   = mygooglepassword
set spoolfile   = +INBOX
mailboxes       = +INBOX

# Store message headers locally to speed things up.
# # If hcache is a folder, Mutt will create sub cache folders for each account which may speeds things even more up.
set header_cache = ~/.cache/mutt
#
# # Store messages locally to speed things up, like searching message bodies.
# # Can be the same folder as header_cache.
# # This will cost important disk usage according to your e-mail amount.
set message_cachedir = "~/.cache/mutt"
#
# # Specify where to save and/or look for postponed messages.
set postponed = +[Gmail]/Drafts
#
# # Allow Mutt to open new imap connection automatically.
unset imap_passive
#
# # Keep IMAP connection alive by polling intermittently (time in seconds).
set imap_keepalive = 300
#
# # How often to check for new mail (time in seconds).
set mail_check = 120
#SMTP Config
set my_pass='mygooglepassword'
set my_user=myemail@gmail.com

set realname = 'Real Name'
set from = myemail@gmail.com
set use_from = yes

set smtp_url=smtps://mygoogleuser:mygooglepassword@smtp.gmail.com
set ssl_force_tls = yes

How to Install FireFox in Kali / Debian Linux

### note this will remove the default iceweasel browser

#### commands only 

root@sincity:~# cat howtoff
apt-get remove iceweasel
echo -e "\ndeb http://downloads.sourceforge.net/project/ubuntuzilla/mozilla/apt all main" | tee -a /etc/apt/sources.list > /dev/null
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com C1289A29
apt-get update
apt-get install firefox-mozilla-build



------ ****** ----- ***** ---- *****

root@sincity:~# apt-get remove iceweasel
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
  baobab caribou caribou-antler dnsmasq-base empathy empathy-common fonts-cantarell gcalctool gdm3 gnome-backgrounds gnome-dictionary
  gnome-disk-utility gnome-font-viewer gnome-icon-theme-extras gnome-packagekit gnome-packagekit-data gnome-screenshot gnome-system-log gucharmap
  libavahi-gobject0 libavahi-ui-gtk3-0 libcaribou-gtk-module libcaribou-gtk3-module libchamplain-0.12-0 libchamplain-gtk-0.12-0 libgdict-1.0-6
  libgdict-common libgdu-gtk0 libgeocode-glib0 libjim0debian2 libnl-route-3-200 libtelepathy-farstream2 libunique-3.0-0
  mobile-broadband-provider-info modemmanager nautilus-sendto-empathy network-manager network-manager-gnome sound-theme-freedesktop telepathy-gabble
  telepathy-logger telepathy-salut usb-modeswitch usb-modeswitch-data vino
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  gnome-core iceweasel
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 7,417 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 316971 files and directories currently installed.)
Removing gnome-core ...
Removing iceweasel ...
Removing 'diversion of /usr/bin/firefox to /usr/bin/firefox.real by iceweasel'
Processing triggers for menu ...
Processing triggers for hicolor-icon-theme ...
Processing triggers for man-db ...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Processing triggers for mime-support ...
root@sincity:~# echo -e "\ndeb http://downloads.sourceforge.net/project/ubuntuzilla/mozilla/apt all main" | tee -a /etc/apt/sources.list > /dev/null
root@sincity:~# apt-key adv --recv-keys --keyserver keyserver.ubuntu.com C1289A29

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.2lZaqzAGjk --trustdb-name /etc/apt//trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-squeeze-automatic.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-squeeze-stable.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-wheezy-automatic.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-wheezy-stable.gpg --keyring /etc/apt/trusted.gpg.d//kali-archive-keyring.gpg --recv-keys --keyserver keyserver.ubuntu.com C1289A29
gpg: requesting key C1289A29 from hkp server keyserver.ubuntu.com
gpg: key C1289A29: public key "Daniel Folkinshteyn (Ubuntuzilla signing key) <nanotube@users.sourceforge.net>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1
root@sincity:~# apt-get update
Get:1 http://downloads.sourceforge.net all Release.gpg [163 B]
Get:2 http://security.kali.org kali/updates Release.gpg [836 B]                    
Get:3 http://downloads.sourceforge.net all Release [1,681 B]                              
Get:4 http://security.kali.org kali/updates Release [11.0 kB]
Get:5 http://downloads.sourceforge.net all/main amd64 Packages [855 B]                                                                            
Get:6 http://security.kali.org kali/updates/main amd64 Packages [259 kB]                                 
Ign http://downloads.sourceforge.net all/main Translation-en_US                             
Hit http://security.kali.org kali/updates/contrib amd64 Packages                                                               
Ign http://downloads.sourceforge.net all/main Translation-en                                                                   
Hit http://security.kali.org kali/updates/non-free amd64 Packages    
Ign http://security.kali.org kali/updates/contrib Translation-en_US
Ign http://security.kali.org kali/updates/contrib Translation-en
Ign http://security.kali.org kali/updates/main Translation-en_US
Ign http://security.kali.org kali/updates/main Translation-en
Ign http://security.kali.org kali/updates/non-free Translation-en_US
Ign http://security.kali.org kali/updates/non-free Translation-en
Fetched 274 kB in 4s (64.9 kB/s)
Reading package lists... Done
root@sincity:~# apt-get install firefox-mozilla-build
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
  baobab caribou caribou-antler dnsmasq-base empathy empathy-common fonts-cantarell gcalctool gdm3 gnome-backgrounds gnome-dictionary
  gnome-disk-utility gnome-font-viewer gnome-icon-theme-extras gnome-packagekit gnome-packagekit-data gnome-screenshot gnome-system-log gucharmap
  libavahi-gobject0 libavahi-ui-gtk3-0 libcaribou-gtk-module libcaribou-gtk3-module libchamplain-0.12-0 libchamplain-gtk-0.12-0 libgdict-1.0-6
  libgdict-common libgdu-gtk0 libgeocode-glib0 libjim0debian2 libmozjs24d libnl-route-3-200 libtelepathy-farstream2 libunique-3.0-0
  mobile-broadband-provider-info modemmanager nautilus-sendto-empathy network-manager network-manager-gnome sound-theme-freedesktop telepathy-gabble
  telepathy-logger telepathy-salut usb-modeswitch usb-modeswitch-data vino xulrunner-24.0
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  firefox-mozilla-build
0 upgraded, 1 newly installed, 0 to remove and 55 not upgraded.
Need to get 47.6 MB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://downloads.sourceforge.net/project/ubuntuzilla/mozilla/apt/ all/main firefox-mozilla-build amd64 34.0.5-0ubuntu1 [47.6 MB]
Fetched 47.6 MB in 59s (797 kB/s)                                                                                                                   
Selecting previously unselected package firefox-mozilla-build.
(Reading database ... 316700 files and directories currently installed.)
Unpacking firefox-mozilla-build (from .../firefox-mozilla-build_34.0.5-0ubuntu1_amd64.deb) ...
Adding 'diversion of /usr/bin/firefox to /usr/bin/firefox.ubuntu by firefox-mozilla-build'
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Setting up firefox-mozilla-build (34.0.5-0ubuntu1) ...
root@sincity:~# firefox











Tuesday, October 28, 2014

Generate new SSH key

root@pulpfiction:~# cd /etc/ssh
root@pulpfiction:/etc/ssh# ls
moduli      sshd_config       ssh_host_dsa_key.pub  ssh_host_ecdsa_key.pub  ssh_host_rsa_key.pub
ssh_config  ssh_host_dsa_key  ssh_host_ecdsa_key    ssh_host_rsa_key
root@pulpfiction:/etc/ssh# ls -a
.   moduli      sshd_config       ssh_host_dsa_key.pub  ssh_host_ecdsa_key.pub  ssh_host_rsa_key.pub
..  ssh_config  ssh_host_dsa_key  ssh_host_ecdsa_key    ssh_host_rsa_key
root@pulpfiction:/etc/ssh# mkdir keys_default
root@pulpfiction:/etc/ssh# mv ssh_host_* keys_default/
root@pulpfiction:/etc/ssh# ls
keys_default  moduli  ssh_config  sshd_config
root@pulpfiction:/etc/ssh# cd keys_Default
bash: cd: keys_Default: No such file or directory
root@pulpfiction:/etc/ssh# cd keys_Default
bash: cd: keys_Default: No such file or directory
root@pulpfiction:/etc/ssh# cd keys*
root@pulpfiction:/etc/ssh/keys_default# ls
ssh_host_dsa_key  ssh_host_dsa_key.pub  ssh_host_ecdsa_key  ssh_host_ecdsa_key.pub  ssh_host_rsa_key  ssh_host_rsa_key.pub
root@pulpfiction:/etc/ssh/keys_default# cd .
root@pulpfiction:/etc/ssh/keys_default# cd ..
root@pulpfiction:/etc/ssh# dpkg-reconfigure openssh-server
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
insserv: warning: current start runlevel(s) (empty) of script `ssh' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (2 3 4 5) of script `ssh' overrides LSB defaults (empty).
root@pulpfiction:/etc/ssh# md5sum ssh_host_*
7e0e98ccbbb3c6c9c0324ce78f7a30b2  ssh_host_dsa_key
25e95c30e94421d0c54a4d8d0fc  ssh_host_dsa_key.pub
6b61f6cabd97a5a33cfa2eaf66f4b2b5  ssh_host_ecdsa_key
060d8943e599272fc7bfb08593  ssh_host_ecdsa_key.pub
303dd1937c094d3fb9da0e1bbf8af38e  ssh_host_rsa_key
1b2d28ba6fdc886asdf7fcd4505a9fa  ssh_host_rsa_key.pub
root@pulpfiction:/etc/ssh# cd key_default
bash: cd: key_default: No such file or directory
root@pulpfiction:/etc/ssh# cd keys_default
root@pulpfiction:/etc/ssh/keys_default# md5sum ssh_host_*
89351fdb4411ce0cdf307617dbbb66a5  ssh_host_dsa_key
3ce46c8d171e372bbfbca3c4aee9fb03  ssh_host_dsa_key.pub
22678cc53669a4cb046c80ed0ede91a4  ssh_host_ecdsa_key
a6a0d18997ddd71985dd9b688a6b8385  ssh_host_ecdsa_key.pub
3af17b8c66ed16bea31a35c94ac47a44  ssh_host_rsa_key
4ff6df59fa0f2a956dab9d05b27b983a  ssh_host_rsa_key.pub
root@pulpfiction:/etc/ssh/keys_default# /etc/init.d/ssh start
[ ok ] Starting OpenBSD Secure Shell server: sshd.

root@pulpfiction:/etc/ssh/keys_default# netstat -antp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      6551/sshd      
tcp6       0      0 :::22                   :::*                    LISTEN      6551/sshd  

Monday, October 27, 2014

#Prelude

#LearningFromScratch
#Linux
#Oracle
#Hack
#MinumumCoding
#QuentinTarantino