Pages

Tuesday, February 12, 2008

Restrict user's other than admin group to do SU ( super user ) on RHEL

By default all user's of Linux OS can do SU ( super user) and attempt to get root privileges ( if they are able to crack root password). We can avoid this by creating a group (i.e Admin) and assigning SU privilege to that group.

vi /etc/pam.d/su

### Uncomment the following line to require a user to be in the "wheel" group.
auth required /lib/security/$ISA/pam_wheel.so use_uid group=Admin

Note:group=Admin need to added after use_uid to group access to SU.

Monday, February 11, 2008

Configuring And Troubleshooting HDLC On Point-To-Point Links

R1#show interface serial 1
Serial1 is up, line protocol is up
Hardware is HD64570
Internet address is 172.12.13.1/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set

R3#show int serial1
Serial1 is up, line protocol is up
Hardware is HD64570
Internet address is 172.12.13.3/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set

At this point, each partner in the PTP link can ping the other.

R1#ping 172.12.13.3

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.12.13.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/36/36 ms

R3#ping 172.12.13.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.12.13.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/35/36 ms



If one of the routers is running another encapsulation type, the physical interfaces will still be up, but the line protocol will go down and IP connectivity will be lost. To illustrate, I'll change the encapsulation type on R3's Serial1 interface to the Point-To-Point Protocol (PPP).

R3(config-if)#exit
R3(config)#int serial 1
R3(config-if)#encapsulation ppp


R3#show interface serial 1
Serial1 is up, line protocol is down

R3#ping 172.12.13.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.12.13.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

R1#show interface serial 1
Serial1 is up, line protocol is down

R1#ping 172.12.13.3

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.12.13.3, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

The encapsulation mismatch has brought the line protocol down, and to bring it back up, we simply need to make the encapsulation types match again.

Wednesday, January 30, 2008

add alias in .bashrc

To avoid typing long commands with there arguments.
here .bashrc minimizes ones burden of typing at CLI.

$vi /home/user/.bashrc

##add following alias into .bashrc file
##--------------------------------------
alias runing='ps -ef | grep -i $1'
alias email='ssh -l username servername'

$source .bashrc

$type runing

runing is aliased to `ps -ef | grep -i $1'


example:
$runing bash
$email

alien - Convert or install an alien binary package

alien is a program that converts between Red Hat rpm, Debian deb, Stam‐
pede slp, Slackware tgz, and Solaris pkg file formats. If you want to
use a package from another linux distribution than the one you have
installed on your system, you can use alien to convert it to your pre‐
ferred package format and install it. It also supports LSB packages.

Here are some examples of the use of alien:

alien --to-deb package.rpm
Convert the package.rpm into a package.deb

alien --to-rpm package.deb
Convert the package.deb into a package.rpm

alien -i package.rpm
Convert the package.rpm into a package.deb (converting to a .deb
package is default, so you need not specify --to-deb), and install
the generated package.

alien --to-deb --to-rpm --to-tgz --to-slp foo.deb bar.rpm baz.tgz
Creates 9 new packages. When it is done, foo bar and baz are avail‐
able in all 4 package formats.

Wallpapoz tool enables your Gnome desktop to have different wallpapers

Install & Run Daemon

$wget
http://darkstar.ist.utl.pt/getdeb/wa/
wallpapoz_0.4.1-1~getdeb1_all.deb

$sudo dpkg -i wallpapoz_0.4.1-1~getdeb1_all.deb

$wallpapoz

$/usr/bin/daemon_wallpapoz &

$ps -ef | grep -i wallpapoz | grep -v grep

check daemon is running in background.

More Information

http://wallpapoz.akbarhome.com/index.html

Tuesday, January 29, 2008

tr - translate or delete characters

translate upper to lower or delete characters

localhost$echo UUU | tr [:upper:] [:lower:]

localhost$tr [:upper:] [:lower:] < file

localhost$cat file | tr [:upper:] [:lower:]

localhost$cat file | tr [:upper:] [:lower:] > tmpfile

run-parts : run scripts or programs in a directory

I kept updating my cron to automate some routine tasks. however noticed many a things in cron are not giving results to my expectation. Was kept suspecting cron is not working or got corrupted.But found errors in crontab entries using run-parts .

here we see how cron and run-scripts works


cron
----
Cron daemon to execute and scheduled commands.
At start it search in cron spool area: /var/spool/cron/ and After that cron.{d,hourly,daily,monthly} and log in /var/log/cron.


Cron Related commands
---------------------

Usage: /etc/init.d/cron {start|stop|restart|reload|force-reload}

usage: crontab [-u user] file
crontab [-u user] { -e | -l | -r }
(default operation is replace, per 1003.2)
-e (edit user's crontab)
-l (list user's crontab)
-r (delete user's crontab)


run-parts
---------
run-parts runs all the executable files named within constraints described below, found in directory directory.Other files and directories are silently ignored.


Usage: run-parts [OPTION]... DIRECTORY
--test print script names which would run, but don't run them.
--list print names of all valid files (can not be used with
--test)
-v, --verbose print script names before running them.
--report print script names if they produce output.
--reverse reverse execution order of scripts.
--exit-on-error exit as soon as a script returns with a non-zero exit
code.
--lsbsysinit validate filenames based on LSB sysinit specs.
-u, --umask=UMASK sets umask to UMASK (octal), default is 022.
-a, --arg=ARGUMENT pass ARGUMENT to scripts, use once for each argument.
-V, --version output version information and exit.
-h, --help display this help and exit.


example :

#run-parts --list /etc/cron.hourly ( list files to executed by run-parts )
#run-parts --test /etc/cron.hourly ( list and test files inside directory )
#run-parts /etc/cron.hourly ( executes files and there output to stdout )