Tuncay Sahin

ICT Engineer | Docent ICT & Trainer

Encryption

If you want to prevent reading your password in your script at first glance, you can use encryptwed passwords.

Create encrypted password

echo “password_to_set” | base64

Decrypt password

MYPASS=’echo “your_encrypted_password” | base64 –decode’

To see some login statistics.

Shows last logged in users details

last

displays hostname in last column

last -a

non-local logins

last -d

Display the system shutdown entries and run level changes

last -x

To display last shutdown date and time

last -x|grep shutdown | head -1

Who is Logged in

who

find time of last system boot

who –b

all login names and number of users logged on

who –q

 

Reporting processors related statistics

mpstat -P cpu | ALL

Display a list of open sockets

netstat -tulpn | grep :80

netstat -ntlp | grep :8009

Remote port check

nc -z 10.178.29.12 1521
Connection to 10.178.29.12 1521 port [tcp/ncube-lm] succeeded!

Finding files

Recursively find all files in current and subfolders based on wildcard matching

find . -name “foo*”

Find big files

alias findbig=’find . -type f -exec ls -s {} \; | sort -n -r | head -10′
findbig

Postfix

Set your smtp relay server

postconf -e “relayhost=your.smtp.relay”

service postfix restart

Testing

echo “This is the main body of the mail”  |mailx -s “Subject of the Email” to@address.com

echo “This is the main body of the mail” | mail -s “Subject of the Email” to@address.com — -f from@address.com

Generate random (pass)words from dictionary file

perl -nle ‘$word = $_ if rand($.) < 1; END { print $word }’ /usr/share/dict/words

Meer informatie

Voor meer informatie of voor een persoonlijk adviesgesprek kunt u altijd vrijblijvend contact met mij opnemen.

E-Mail

info@tuncaysahin.nl