Did you know that you can reset file permission to what they were when you installed the package. This may become helpful if somebody made a mistake and change the permission on a number of files (This never happen right?). This is where the command ;
“rpm –setperms <package>” become handy.
In our example we will change the permission on the “find” command.
# Let's find out what package contains the "/usr/bin/find" command
# rpm -qf /usr/bin/find
findutils-4.2.27-5.el5
# Let's see what are the actual permission of the find program (755).
# ls -l /usr/bin/find
-rwxr-xr-x 1 root root 151244 Jul 7 2008 /usr/bin/find
# Let's change them to 777 with the chmod command
# chmod 777 /usr/bin/find
# Now the program "find" have this permission.
# ls -l /usr/bin/find
-rwxrwxrwx 1 root root 151244 Jul 7 2008 /usr/bin/find
# Let's run our command to reset all files included in the package "findutils".
# rpm --setperms findutils
# You can see now that the permission of the 'find' are back to their initial state.
# ls -l /usr/bin/find
-rwxr-xr-x 1 root root 151244 Jul 7 2008 /usr/bin/find
Be aware that this command only reset the permission and not the owner/group of the file, as you can see from the example below.
# ls -l /usr/bin/find
-rwxr-xr-x 1 root root 151244 Jul 7 2008 /usr/bin/find
# chmod 777 /usr/bin/find
# chown jacques.jacques /usr/bin/find
# ls -l /usr/bin/find
-rwxrwxrwx 1 jacques jacques 151244 Jul 7 2008 /usr/bin/find
# rpm --setperms findutils
# ls -l /usr/bin/find
-rwxr-xr-x 1 jacques jacques 151244 Jul 7 2008 /usr/bin/find
You need to add an IP address on interface eth0 ? Use the following command to activate it.
ifconfig eth0:1 192.168.1.177 netmask 255.255.255.0
Now you want to delete it ? No problem, use the following command ;
ifconfig eth0:1 del 192.168.1.177
You can also create a file /etc/sysconfig/network-scripts/ifcfg-eth0:1 to have the IP automatically come up upon reboot.
# cat /etc/sysconfig/network-scripts/ifcfg-eth0:1
TYPE=Ethernet
# Device Name
DEVICE=eth0:1
# Boot Protocol none,bootp,dhcp
BOOTPROTO=none
# IP Address
IPADDR=192.168.1.177
# Netmask
NETMASK=255.255.255.0
# Normal user cannot activate/deactivate it
USERCTL=no
# IPv6 Actvated
IPV6INIT=no
# Use the parent interface
ONPARENT=yes
# yes = Modify /etc/resolv.conf if DNS directive is set
# If using DCHP, then yes is the default
# no = Do not modify /etc/resolv.conf
PEERDNS=no
We usually use the “less” command to browse the content of a text file. We use the [Page-Up], [Page-Down], [Down-Arrow], [Up-Arrow] keys to move within the file, but did you know that you can do more with the less command ?
You can see the content of a rpm file
# less flash-plugin-9.0.124.0-release.i386.rpm
Name : flash-plugin Relocations: (not relocatable)
Version : 9.0.124.0 Vendor: Adobe Systems Inc.
Release : release Build Date: Tue 25 Mar 2008 12:21:32 PM EDT
Install Date: (not installed) Build Host: fplayerbuild2-lnx.macromedia.com
Group : Applications/Internet Source RPM: flash-plugin-9.0.124.0-release.src.rpm
Size : 8161247 License: Commercial
Signature : (none)
Packager : Adobe Systems Inc.
URL : http://www.adobe.com/downloads/
Summary : Adobe Flash Player 7.0
drwxr-xr-x 2 root root 0 Mar 25 2008 /usr/lib/flash-plugin
-rw-r--r-- 1 root root 34516 Mar 24 2008 /usr/lib/flash-plugin/LICENSE
-rw-r--r-- 1 root root 3180 Mar 24 2008 /usr/lib/flash-plugin/README
-rwxr--r-- 1 root root 1367 Mar 24 2008 /usr/lib/flash-plugin/homecleanup
-rwxr-xr-x 1 root root 115888 Mar 25 2008 /usr/lib/flash-plugin/libflashplayer.so
-rwxr--r-- 1 root root 3116 Mar 24 2008 /usr/lib/flash-plugin/setup
drwxr-xr-x 2 root root 0 Mar 25 2008 /usr/share/doc/flash-plugin-9.0.124.0
-rw-r--r-- 1 root root 3180 Mar 25 2008 /usr/share/doc/flash-plugin-9.0.124.0/readme.txt
(END)
View the content of zip file :
$ less StudioPress.zip
Archive: StudioPress.zip 196759 bytes 42 files
drwxr-xr-x 2.3 unx 0 bx stor 17-Sep-08 09:05 StudioPress/
-rw-r--r-- 2.3 unx 3848 tx defN 14-Jan-08 09:05 StudioPress/comments.php
-rw-r--r-- 2.3 unx 231 tx defN 14-Jan-08 09:05 StudioPress/searchform.php
-rw-r--r-- 2.3 unx 169 tx defN 4-Feb-08 09:44 StudioPress/adsense_top.php
-rw-r--r-- 2.3 unx 1393 tx defN 5-Feb-08 06:50 StudioPress/home.php
-rw-r--r-- 2.3 unx 1411 tx defN 14-Jan-08 09:05 StudioPress/functions.php
View the content of tar or tgz file
$ less update_inv.tar
drwxr-xr-x jacques/jacques 0 2008-01-03 20:48:50 update_inv/
drwxr-xr-x jacques/jacques 0 2008-03-22 13:52:07 update_inv/log/
-rw-rw-r-- jacques/jacques 0 2008-03-22 13:52:07 update_inv/log/update_inv.log
drwxr-xr-x jacques/jacques 0 2008-03-22 13:52:33 update_inv/html/
-rw-rw-r-- jacques/jacques 941 2008-03-26 19:24:51 update_inv/html/gumby.html
drwxr-xr-x jacques/jacques 0 2008-03-22 13:52:07 update_inv/tmp/
-rwxrwxr-x jacques/jacques 19059 2008-03-26 19:00:43 update_inv/update_inventory.py
update_inv.tar (END)
Recent Comments