Category: Tips and Tricks

Create TAP/TUN device CentOS 7

Here is how to do it on CentOS 7 / RedHat 7 where the command  tunctl is missing and when you try to run ifconfig you get an error ~# ifconfig tap0 10.0.0.1/30 SIOCSIFADDR: No such device tap0: ERROR while

Posted in Tips and Tricks Tagged with: , , ,

Bash Special Variables

Bash shell has some built in variables that can be use in scripts for example if you want to know the process id of the current command , you may use $$ here is a list of some special variables

Posted in Tips and Tricks Tagged with:

simple install sun java

a quick and eazy way to install java under linux 1. download jre or jdk from www.java.com 2. create a directory to hold the versions # mkdir /usr/java 3. extract the tar file under the directory # tar -xzvf jre-7u45-linux-x64.tar.gz

Posted in Tips and Tricks Tagged with: ,

bash history security

Bash history can reviel what a person commands where . but what if the person wants to hide his tracks , he may use the unset HISTFILE will couse bash to delete the history upon logout . there is how

Posted in Tips and Tricks Tagged with: , ,

Manage partitions on a raw device file

Every once in a while there comes a time when you need to use a file as raw device for example when using qemu qcow file or if you want to have your home directory portable and encrypted in this

Posted in Tips and Tricks Tagged with: , ,

multi-line comment with vi

Vi editor is one of my favourite text editor to work with under linux/Unix systems , and from time to time there comes a need to mark multiple lines as comment . here is how you can do it in

Posted in Tips and Tricks Tagged with: , ,

samba PDC sambaLogonTime update

Samba doesnt update sambaLogonTime in LDAP when a user login in order to have it set , one can run a script that will do it set up a script /root/update_sambaLogonTime.sh #!/bin/bash TIMESTAMP=$(date +%s) ldapmodify -x -h localhost -D “cn=Manager,dc=example,dc=com”

Posted in Tips and Tricks Tagged with: ,

samba password complexity check

Samba server can act as PDC ( primary domain controller ) . you can force password policy with pdbedit command , but it doesnt check for complexity . in order to check complexity samba provides “check password script” attribute in

Posted in Tips and Tricks Tagged with: ,

Export Import gpg keys

1. list current keys $ gpg –list-keys /home/yyagol/.gnupg/pubring.gpg ——————————- pub 1024D/5E92C97A 2010-04-13 yyagol <[email protected]> sub 2048g/2752CC68 2010-04-13 2. export both public and private $ gpg –output mygpgkey_pub.gpg –armor –export 5E92C97A $ gpg –output mygpgkey_sec.gpg –armor –export-secret-key 5E92C97A 3. copy the

Posted in Tips and Tricks Tagged with: ,

file as raw device

Sometimes there is a need to have a file act as raw device , here is a simple trick that you can take in order to achieve that goal (all commands should run as root) : 1. create an empty

Posted in Tips and Tricks Tagged with: ,