Linux Tips and Tools: Difference between revisions

From Research
Jump to navigation Jump to search
(Colourize Grep)
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 NCL -t -m 9 -x 9 -n 10 -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.
*'''-m 9''' minimum password length
*'''-m 9''' minimum password length
*'''-x 9''' maximum password length
*'''-x 9''' maximum password length

Revision as of 23:36, 8 January 2009

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 NCL -t -m 9 -x 9 -n 10 -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
  • -m 9 minimum password length
  • -x 9 maximum password length
  • -n 10 generate 10 passwords After the egrep filtering below, you will get substantially fewer than 10 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