Operating System - HP-UX
1753608 Members
6084 Online
108797 Solutions
New Discussion юеВ

Re: Verifying an installed file on HPUX

 
SOLVED
Go to solution
xpz25nfh
New Member

Verifying an installed file on HPUX

Hello Folks,

I want to check if an installed binary on the HPUX has been installed correctly.

For example, I want to validate that the binary "/usr/bin/passwd" is the correct size, has the correct checksum and the correct permission bits set.

In Linux, I can check this with "rpm -Vif , on Solaris, I use "pkgchk", and on AIX, I use "lppchk".

How can I do this on HPUX?

Thank you!
9 REPLIES 9
Luk Vandenbussche
Honored Contributor

Re: Verifying an installed file on HPUX

You can check softwares with swverfiy.

Check 'man swverify'
xpz25nfh
New Member

Re: Verifying an installed file on HPUX

Thanks.

I did this, but for the life of me, I cannot figure out the correct command line arguments to get the information I need.

Anyone have an example?

Thanks again!
whiteknight
Honored Contributor

Re: Verifying an installed file on HPUX

Here is the steps

To list the filesets and fix any incorrect permission / ownership issues:

# swlist -l file | grep "/usr/bin/ftio"
OS-Core.SYS2-ADMIN: /usr/bin/ftio
# swlist -l file | grep "/usr/bin/iostat"
OS-Core.SYS2-ADMIN: /usr/bin/iostat
# swlist -l file | grep "/usr/bin/mt"
OS-Core.SYS2-ADMIN: /usr/bin/mt
# swverify -v -x fix=true OS-Core.SYS2-ADMIN

hope it help.
WK.
Problem never ends, you must know how to fix it
xpz25nfh
New Member

Re: Verifying an installed file on HPUX

Thanks WK. It's getting closer.

What I would like to do is to display the attributes of a file itself. For example, in the Solaris world, I can do this:

bash-2.05$ pkgchk -l -p /usr/bin/passwd <-- This command queries the database w.r.t the "passwd" file
Pathname: /usr/bin/passwd
Type: regular file
Expected mode: 6555 <-- These permission bits map exactly to what the actual is: -r-sr-sr-x
Expected owner: root
Expected group: sys
Expected file size (bytes): 21964 <-- The files expected byte size matches with the actual byte size.
Expected sum(1) of contents: 20849 <-- More importantly, does the digital signature of this file match? See below.
Expected last modification: Apr 06 18:01:14 2002
Referenced by the following packages:
SUNWcsu
Current status: installed

How can I retrieve the same info from the "sw" commands?

Thanks!
James R. Ferguson
Acclaimed Contributor
Solution

Re: Verifying an installed file on HPUX

Hi:

First find the fileset in which the file resides:

# swlist -l file|grep /usr/bin/passwd

Using the fileset name found:

# swlist -l file -v |more

Regards!

...JRF...

xpz25nfh
New Member

Re: Verifying an installed file on HPUX

Thanks JRF.

It's ugly. It takes a long time. But it works.

Thank you very kindly.
xpz25nfh
New Member

Re: Verifying an installed file on HPUX

Closed
Dennis Handly
Acclaimed Contributor

Re: Verifying an installed file on HPUX

You can of course use "swverify \*" to verify everything. This will tell you what's wrong. Add -F to fix.

>What I would like to do is to display the attributes of a file itself.

swverify will tell you what's wrong.

>JRF: First find the fileset in which the file resides:
>It's ugly. It takes a long time.

The following is a faster. And using -a can make it prettier.
If you are root, you can do this faster with:
# find /var/adm/sw/products -name INFO -exec grep -l /usr/bin/passwd
/var/adm/sw/products/OS-Core/UX2-CORE/INFO
/var/adm/sw/products/PHCO_31616/UX2-CORE/INFO
/var/adm/sw/products/PHCO_32149/UX2-CORE/INFO

Then you do:
swlist -a path -a type -a size -a cksum -a mode -a uid -a gid -a owner -a group \
-a mtime -a link_source -l file \*.UX2-CORE | \
grep -e /usr/bin/passwd -e chfn

I found that passwd is a hardlink to chfn, so I added both
Dennis Handly
Acclaimed Contributor

Re: Verifying an installed file on HPUX

Oops, I dropped the "+" on the end of that find:
# find /var/adm/sw/products -name INFO -exec grep -l /usr/bin/passwd +