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 SIOCSIFADDR: No such device tap0: ERROR while

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

Tagged with:

simple install sun java

a quick and eazy way to install java under linux 1. download jre or jdk from 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

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

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

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

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/ #!/bin/bash TIMESTAMP=$(date +%s) ldapmodify -x -h localhost -D “cn=Manager,dc=example,dc=com”

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

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

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

Tagged with: ,