Archive for the ‘Bash’ Category

Finding and removing files with weak permissions 2

This is a nice little script that I use to clean up files and directories with poor permissions. Its great to use in preparation before installing mod_suPHP/PHP suexec.
#!/bin/bash
# Make sure all files are owned by the correct user. Get rid of file owned by nobody
for i in $(ls /home| cut -f1 -d/); do chown -R [...]

Adding Timestamps to your bash history 0

This is easily done by adding two lines to your .bashrc file.
HISTTIMEFORMAT="(%m/%d/%y) %T "
export HISTTIMEFORMAT
Now your bash history will have the date and time that each command was run.
545  (11/05/07) 08:46:14 ssh root@192.168.0.1

Bash Prompt 0

I created this prompt to match my irssi theme ski. Below are the parts necessary to have your own just like it. Insert this into your .bashrc and then source ~/.bashrc
# Color Variables for Prompt
GRAD1=‘\333\262\261\260′
GRAD2=‘\260\261\262\333′
YLOBRN=‘\[\033[01;33;43m\]‘
WHTBRN=‘\[\033[01;37;43m\]‘
REDBRN=‘\[\033[00;31;43m\]‘
REDBLK=‘\[\033[00;31;40m\]‘
PPLBLK=‘\[\033[01;35;40m\]‘
WHTBLK=‘\[\033[01;37;40m\]‘
CYNBLK=‘\[\033[01;36;40m\]‘
NONE=‘\[\033[00m\]‘
HBLK=‘\[\033[00;30;30m\]‘
HBLU=‘\[\033[01;34;34m\]‘
BLU=‘\[\033[00;34;34m\]‘
YEL=‘\[\033[00;33;33m\]‘
WHT=‘\[\033[01;37;37m\]‘
PRPL=‘\[\033[00;34;35m\]‘
RED=‘\[\033[01;31;31m\]‘
NORM=‘\[\033[01;00;0m\]‘
Prompt PS1=‘\n‘$CYNBLK‘['$NONE'\u'$PPLBLK'@'$NONE'\h'$WHT':'$HBLU'\W'$CYNBLK']‘$NONE‘ ‘