Home
Linux Redhat/Feudora reference notes
Manually add route in Linux

192.168.80.0 /24 = your virtual machine  network
10.14.8.127 /22 = gateway - your next hop either PC or router

 route add -net 192.168.80.0[[ip network]] netmask 255.255.255.0[[subnet mask]] gw 10.14.8.127[[ip gateway]] metric 1 dev eth0

FSTAB corrupted - how to

Boot using Linux bootable CD/DVD
fdisk -l
mkdir /mnt/sysimage
mount /dev/sda# /mnt/sysimage/  (#=hard drive number)
cd /mnt/sysimage/
df - h (view the file system mounted)
restore the backup fstab file
reboot

Useradd / Groupadd

Usermod/Groupmod

Userdel/Groupdel

1) which useradd
2) rpm -qf /usr/sbin/useradd (qf=query file)
3) less /etc/login.defs
4) useradd user1
5) tail /etc/passwd (/etc/passwd=default user password file, /etc/shadow=the file is encrypted  only read by root) 

Fields in /etc/passwd

Shadow reference:uid:gid:description (gecos):$HOME:$Shell

 Fields in /etc/shadow
1) Username:
2) Encrypted password:
3) Days since unix epoch
4) Daysbefore password maybe changed
5) Days after which the password MUST be changed
6) Days before password expires, that account is disabled
7) Days after the password expires, that account is disabled
8) Days since Unix epoch, that account is disabled
9) Reserved filed (currently unused)

 VISUDO

if you want sudo without prompt password,


edit /etc/sudoers

and add:

username ALL=(ALL) NOPASSWD: ALL

Editors for Redhat- 

to use different editor instead vi - export EDITOR=nano

1) vi
2) nano
3) pico

 CRON- rpm -q cron , rpm -qa | grep -i cron, rpm -ql vixie-cron, ls -l /etc/cron, ls -l /etc/cron.d

1. Scheduler

2.  Rules (Cron entries) are based on times:

a.  minute (0-59)
b.  hour (0-23)
c.  day of the month (1-31)
e.  month (1-12)
f.  comman to execute (shell, perl, php, etc.)

3.  Wakes up every minute in search of programs to execute

4.  Reads cron entries from multiple files

 5.  Maintains per-user and system-wide schedules

crontab -e = edit crontab entrys using default editor such as vi or use this command export EDITOR=nano to change it to nano editor instead vi

1) uptime | awk " {print $8, $9, $10, $11, $12 } ' 

2) 

FILENAME=load_averages
uptime | awk " {print $8, $9, $10, $11, $12 } ' >> $FILENAME

CHANGE cron to executable = chmod +x load_averages.sh

 
Next >
VM4D