Linux Tips and Tools
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 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
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 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
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