Wednesday, September 30, 2015

Sudo no password

all user no password

sudo visudo
..
ALL ALL=(ALL) NOPASSWD:ALL
 
spesific user no password
 
sudo visudo
....
<user> ALL=(ALL) NOPASSWD:ALL

Wednesday, September 2, 2015

Duplicating Raspberry Image The hard Way

Compressed backup system

Insert sdcard containing working raspberry system
says it way detected as /dev/sdc/

copying the partition
sudo sfdisk -d /dev/sdc > partition.layout

mounting the sdcard
sudo mount /dev/sdc2 /mnt
sudo mount /dev/sdc1 /mnt/boot

compressing your system
cd /mnt
sudo tar cjvf /home/user/imagerpi-0000.tar.bz2 *

unmounting sdcard
cd ~
sudo umount /mnt/boot
sudo umount /mnt
unplug your sdcard

Cleanup log file

Simple script to clean up log file
vi cleanlog

#-------------------------------------------------------
#!/bin/bash

# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
   echo "$0 must be run as root" 1>&2
   exit 1
fi

if [ "$1" ];then
   LOGDIR=$1
   if [ ! -d "$1" ];then
      echo "$1 not exist"
      exit 0
   fi
else
   LOGDIR="/var/log"
fi