Linux Tips and Tools: Difference between revisions

From Research
Jump to navigation Jump to search
 
(6 intermediate revisions by 3 users not shown)
Line 2: Line 2:
Use of automated tools will help ensure high-quality passwords, enhancing security.  '''apg''' is one such tool, which (by default) attempts to generate pronounceable passwords.
Use of automated tools will help ensure high-quality passwords, enhancing security.  '''apg''' is one such tool, which (by default) attempts to generate pronounceable passwords.
Once '''apg''' is installed, invoking it like this will produce best results:
Once '''apg''' is installed, invoking it like this will produce best results:
  <font color=red>hostname</font> <font color=blue>~ #</font> '''/usr/bin/apg -M NCL -k -t -m 9 -x 9 -n 10 -E O | egrep -v [ol]'''
  <font color=red>hostname</font> <font color=blue>~ #</font> '''/usr/bin/apg -M NCLS -t -k -m 12 -x 12 -n 20 -E O | egrep -v [ol]'''
Explanation of options:
Explanation of options:
*'''-M''' is a mode-switch, with following options which tell '''apg''' what characterset to use
*'''-M''' is a mode-switch, with following options which tell '''apg''' what characterset to use
Line 8: Line 8:
**'''-C''' upper-case (capital) letters must be included
**'''-C''' upper-case (capital) letters must be included
**'''-L''' lower-case letters must be included
**'''-L''' lower-case letters must be included
*'''-k''' check every generated password using cracklib.  Cracklib support must be compiled-in.
**'''-S''' include special symbol set (punctuation and so on); uppercase makes this mandatory
*'''-m 9''' minimum password length
*'''-t''' print out the pronunciation (in brackets) after the actual password
*'''-x 9''' maximum password length
*'''-k''' check password against cracklib; requires that apg be compiled with cracklib support (may not always be the case, on our various machines)
*'''-n 10''' generate 10 passwords  After the '''egrep''' filtering below, you will get substantially fewer than 10 results.
*'''-m 12''' minimum password length
*'''-x 12''' maximum password length
*'''-n 20''' generate 20 passwords  After the '''egrep''' filtering below, you will get substantially fewer than 20 results.
*'''-E O''' exclude letters (upper-case only possible) O from password.  This prevents confusion with "oh" and "zero".
*'''-E O''' exclude letters (upper-case only possible) O from password.  This prevents confusion with "oh" and "zero".
*'''| egrep -v [ol]''' does the same as above, except it filters out/discards passwords with lower-case ol.  This prevents confusion with "oh" and "zero"; "ell" and "one".
*'''| egrep -v [ol]''' does the same as above, except it filters out/discards passwords with lower-case ol.  This prevents confusion with "oh" and "zero"; "ell" and "one".
Line 31: Line 33:
  <font color=blue>#</font> screen -r ####
  <font color=blue>#</font> screen -r ####
The first to reattach a session, and the second to list the screen sessions. The third is useful if there is more than one screen sessions you can reattach. Just list the sessions and then reattach with the specific numbers given for the session you want.
The first to reattach a session, and the second to list the screen sessions. The third is useful if there is more than one screen sessions you can reattach. Just list the sessions and then reattach with the specific numbers given for the session you want.
<br>


== Genlop ==
== Genlop ==
Line 41: Line 45:
  # genlop -c
  # genlop -c
  # genlop -i gcc
  # genlop -i gcc
== Colourize Grep ==
Add this to your '''.bashrc''' file.
<pre>
if echo hello|grep --color=auto l >/dev/null 2>&1; then
  export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
fi
</pre>

Latest revision as of 18:23, 10 October 2013

Automatic (Pronounceable) Password Generation

Use of automated tools will help ensure high-quality passwords, enhancing security. apg is one such tool, which (by default) attempts to generate pronounceable passwords. Once apg is installed, invoking it like this will produce best results:

hostname ~ # /usr/bin/apg -M NCLS -t -k -m 12 -x 12 -n 20 -E O | egrep -v [ol]

Explanation of options:

  • -M is a mode-switch, with following options which tell apg what characterset to use
    • -N numbers must be included with each password
    • -C upper-case (capital) letters must be included
    • -L lower-case letters must be included
    • -S include special symbol set (punctuation and so on); uppercase makes this mandatory
  • -t print out the pronunciation (in brackets) after the actual password
  • -k check password against cracklib; requires that apg be compiled with cracklib support (may not always be the case, on our various machines)
  • -m 12 minimum password length
  • -x 12 maximum password length
  • -n 20 generate 20 passwords After the egrep filtering below, you will get substantially fewer than 20 results.
  • -E O exclude letters (upper-case only possible) O from password. This prevents confusion with "oh" and "zero".
  • | egrep -v [ol] does the same as above, except it filters out/discards passwords with lower-case ol. This prevents confusion with "oh" and "zero"; "ell" and "one".


Screen

Screen is a very powerful terminal application that makes server and remote maintenance much easier.

Screen sessions can be created, detached, and then later resumed from another machine. This allows you to ssh to a machine, start a compile or emerge, detach and logout, and then come back later to the session and see it finished.

Screen session are created from the terminal with

# screen

A session is detached by a Ctrl-a d.

There are three more commands you should know:

# screen -r
# screen -ls
# screen -r ####

The first to reattach a session, and the second to list the screen sessions. The third is useful if there is more than one screen sessions you can reattach. Just list the sessions and then reattach with the specific numbers given for the session you want.


Genlop

Gentoo Linux

Genlop is a log reporting program for gentoo's portage utility. Want to know how much longer the package being emerged will take? or average emerge time? This program has it all

# emerge genlop

Here's how to use it. First is emerge history, second is information on the current package being emerged + expected time remaining, third is for averge build time of that package.

# genlop -l
# genlop -c
# genlop -i gcc

Colourize Grep

Add this to your .bashrc file.

if echo hello|grep --color=auto l >/dev/null 2>&1; then
  export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
fi