Operating System - HP-UX
1833187 Members
2998 Online
110051 Solutions
New Discussion

Re: Submit Very Basic System administration commands and win easily points

 
SOLVED
Go to solution
K.Vijayaragavan.
Respected Contributor

Re: Submit Very Basic System administration commands and win easily points

securing inetrnet services

We can allow / deny access to internet services running in a HPUX server by editing the file "/var/adm/inetd.sec".

we can allow /deny certain IPs or networks in accessing the services running on the server.

-vijay
"Let us fine tune our knowledge together"
K.Vijayaragavan.
Respected Contributor

Re: Submit Very Basic System administration commands and win easily points

Command to find whether the HPUX 11.00 is 64 bit / 32 bit one?
#getconf KERNEL_BITS
(It will just display "64" if it OS is 64 bit.)
"Let us fine tune our knowledge together"
K.Vijayaragavan.
Respected Contributor

Re: Submit Very Basic System administration commands and win easily points

Simple command to find the IP address of a system ?

#getip

simple command to find the hostname of a system?
# hostname

-Vijay
"Let us fine tune our knowledge together"
K.Vijayaragavan.
Respected Contributor

Re: Submit Very Basic System administration commands and win easily points

RUN LEVEL OF THE HPUX SERVER

Simple command to find the current run level of HPUX server ?

#who -r

-Vijay
"Let us fine tune our knowledge together"
Justo Exposito
Esteemed Contributor

Re: Submit Very Basic System administration commands and win easily points

Hi,

The most simple command that I know is "w", this command tell you time up, users connected to the system and load average.

Try it.

Regards,

Justo.
Help is a Beatiful word
John Waller
Esteemed Contributor

Re: Submit Very Basic System administration commands and win easily points

If you have a filesystem which suddenly increases in size try

find / -type f -mtime 0 -exec ls -l {} \;

This will list all files modified in the last 24 hours

Robert Gamble
Respected Contributor

Re: Submit Very Basic System administration commands and win easily points

For monitoring a server's syslog:

1) leave a window of this command running: # tail -f /var/adm/syslog/syslog.log

2) write a script that runs in a cron (frequently) to grep out a 'FATAL' or 'WARNING' (or any other message you deem important) out of the syslog and send report to pager if conditions exist.

3) write a script that runs in cron daily to filter out normal syslog entries and send the rest to your email address
Deshpande Prashant
Honored Contributor

Re: Submit Very Basic System administration commands and win easily points

HI
The clean up utility helps recovering space in /var/adm/sw/save dir by removing save set for superseeded patches.
You can commit single patch by using
#swmodify -x patch_commit=true

Thanks.
Prashant.
Take it as it comes.
Pal Szabo_1
Valued Contributor

Re: Submit Very Basic System administration commands and win easily points

Determine your machine type and supported kernel mode(32/64bit) (HPUX11)

machine type:
# model

supported kernel mode:
# cat /etc/.supported_bits/ |
grep `model`

Victor BERRIDGE
Honored Contributor

Re: Submit Very Basic System administration commands and win easily points

You can edit a file to remove stale login entries.
This happens on occassion with a server we have.

To remove logins that you know are not valid:

/usr/sbin/acct/fwtmp < /etc/utmp > /tmp/utmp.txt

Edit the file /tmp/utmp.txt with your favorite editor. Using vi, I search for
the offending pid, make sure the line it is on matches the userid indicated
in the who output, then delete that one line. Repeat as needed for other
logins. Then:

/usr/sbin/acct/fwtmp -ic < /tmp/utmp.txt > /etc/utmp

Now when you do a who or 'w', then your results should be valid.

Be careful when doing this as utmp maintains a record of all users who are
currently logged on the system.

The file utmp, also btmp and wtmp, are binary files and you need to convert
them to a text file to edit. You can also use this command to trim the btmp
and wtmp files as they will grow limited only by the amount of disk space
availabel to them.

All the best

Victor
George_Dodds
Honored Contributor

Re: Submit Very Basic System administration commands and win easily points

Linkloop - used to check connectivity within a lan.

man linkloop for more info.
S.K. Chan
Honored Contributor

Re: Submit Very Basic System administration commands and win easily points

****** GHOST DISK ELIMINATOR PROCEDURE ******

A) Scenario that could create a ghost disk :-
o A disk is physically removed before removing it logically. After a disk failure, a "vgscan -v" was issued in order to eliminate the damaged disk from /etc/lvmtab.
o LVM disk failure while system is still on-line.

B) This is what you should do ..
1) # vgdisplay -v vg03
....
vgdisplay: Warning couldn't query physical volume "/dev/dsk/c1t2d5". The specified path does not corrsspond to physical volume attached to this VG. vgdisplay: Warning: couldn't query all of the physical volumes.
...
==> YOU GOT GHOST !!

2) # strings /etc/lvmtab
...
vg03
/dev/dsk/c2t4d0
/dev/dsk/c1t2d5
...
==> will still show c1t2d5 in it but if you look at output from 1) closely ..
....
Curr PV 2
Act PV 1
....
LV Name /dev/vg03/lvol1
LV Status available/stale
....
==> you then know only 1 PV is good and we got a "stale" LV.

3) # lvdisplay -v /dev/vg03/lvol1
lvdisplay: Warning: couldn't query ..
....
LV Name /dev/vg03/lvol1
...
Mirror coipes 1
...
--- Distribution of logical volume ---
PV Name LE on PV PE on PV
/dev/dsk/c2t4d0 500 500

--- Logical extents ---
LE PV1 PE1 Status 1 PV2 PE2 Status 2
0000 /dev/dsk/c2t4d0 0000 current ??? 0000 stale
........

4) At this point if you run ..
# lvreduce -m 0 /dev/vg03/lvol1 /dev/dsk/c1t2d5
it'll still give you error ..."couldn't query..", to reduce it we need the "disk-key". Run 3) with -k again to get the "disk-key" value.

5) # lvdisplay -v -k /dev/vg03/lvol1
==> The PV1 and PV2 column, instead of displaying the device path, it'll show the "disk-key" value (either 0 or 1).

6) # lvreduce -m 0 -k /dev/vg03/lvol1 1
==> Now reduce it with the "disk-key" value. In this case it's 1.

7) Finish up the rest of the steps ..
# mv /etc/lvmtab /etc/lvmtab.org
# vgscan -v
# vgreduce -f vg03 (f option force removal of missing PVs)

Glenn L. Stewart
Frequent Advisor

Re: Submit Very Basic System administration commands and win easily points

Script logfile redirection from cron/at

Instead of this example cron entry:

10 * * * * /dir/script.sh >> /dir/log 2>&1

Include the following lines in script, to have script maintain the location of the log file.
The benefits of this are:

1. Log file known from script and therefore can trim it's own log.
2. Simple crontab entry
3a. Run from command line produces stdout
3b. Run from cron/at goes to log instead

Insert the following into script:
----
LOGFILE=/dir/log
if ! /usr/bin/tty > /dev/null 2>&1
then
# User running script from crontab or at job
# Redirect all standard output/error to $LOGFILE
exec >> $LOGFILE
echo "-----------------------------------------"
echo $DATE
fi

You can remove echo's of course without a problem. Change the >> to > if you don't want to append the log.

Glenn
Glenn L. Stewart
Frequent Advisor

Re: Submit Very Basic System administration commands and win easily points

Kill all processes of a particular user - of course, check output of grep before doing so.

Semi-safe:
ps -ef | grep username | cut -c10-15 | xargs kill -9

Safer:
ps -ef | awk '{print $1" "$2}' | grep ^username | awk '{print $NF}' | xargs kill -9

Glenn
K.Vijayaragavan.
Respected Contributor

Re: Submit Very Basic System administration commands and win easily points

Command to set the HPUX system to intial stage
==============================================
(ie where we can aasign new hostname,timezone,date_time,root_passwd,ip_address,addl. network parameters like gateway,subnetmask) ?

# set_parms

To change time ip_address alone
===============================
#set_parms ip_address

similarly we can change the rest.

Note :

This command will be helpfull in changing the network parameters effectively without any problems.

Just a change in /etc/hosts will not make enough changes in a hp server to assign a new ip.

-Vijay
"Let us fine tune our knowledge together"
K.Vijayaragavan.
Respected Contributor

Re: Submit Very Basic System administration commands and win easily points

Command to set the HPUX system to intial stage
==============================================
(ie where we can aasign new hostname,timezone,date_time,root_passwd,ip_address,addl. network parameters like gateway,subnetmask) ?

# set_parms

To change ip_address alone
===============================
#set_parms ip_address

similarly we can change the rest.

Note :

This command will be helpfull in changing the network parameters effectively without any problems.

Just a change in /etc/hosts will not make enough changes in a hp server to assign a new ip.

-Vijay
"Let us fine tune our knowledge together"
K.Vijayaragavan.
Respected Contributor

Re: Submit Very Basic System administration commands and win easily points

Command to get the current run level as well as previous run level of a HPUX server?

#getrunlvl


-Vijay
"Let us fine tune our knowledge together"
K.Vijayaragavan.
Respected Contributor

Re: Submit Very Basic System administration commands and win easily points

Command to boot the HPUX server in single user mode without logical volumes availability?

# hpux -is

-vijay
"Let us fine tune our knowledge together"
K.Vijayaragavan.
Respected Contributor

Re: Submit Very Basic System administration commands and win easily points

command to boot the hpux server in single user mode with the support of logical volume from ISL prompt?

hpux -lm

-vijay


"Let us fine tune our knowledge together"
K.Vijayaragavan.
Respected Contributor

Re: Submit Very Basic System administration commands and win easily points

Command to boot the HPUX server in interactive mode (where we can decide whether to go to single user mode / runlevel 1 /runlevel 2/runlevel 3/runlevel 4 ) from ISL prompt?

hpux -im

-vijay

"Let us fine tune our knowledge together"
Varghese Mathew
Trusted Contributor

Re: Submit Very Basic System administration commands and win easily points

Hi,

To delete the files which are older then 15 days in a directory. Script contains just two lines.

find /xyz/temp -mtime +15 -exec ls -l {} \;
find /xyz/temp -mtime +15 -exec rm {} \;

thats it..
Cheers !!!
VM

Cheers !!!
Victor BERRIDGE
Honored Contributor

Re: Submit Very Basic System administration commands and win easily points

To complete S.K Chan's procedure, I would run regularily a script that includes a statement similar to the line below (look for stale lvms...).

for lv in `vgdisplay -v|awk '/LV Name/ {print$NF}'`;do lvdisplay -v $lv|grep -i stale;done

All the best
Victor
K.Vijayaragavan.
Respected Contributor

Re: Submit Very Basic System administration commands and win easily points

Denying FTP access to certain users ?

enter list of users to whom you want to deny ftp in the file "/etc/ftpusers"

Generally system users (sys group members) are listed in this file for security precautions.

-vijay
"Let us fine tune our knowledge together"
Krishna Prasad
Trusted Contributor

Re: Submit Very Basic System administration commands and win easily points

Start and stop nfs services


cd /sbin/init.d

./nfs.server stop
./nfs.client stop
./nfs.core stop

./nfs.core start
./nfs.server start
./nfs.client start
Positive Results requires Positive Thinking
simon wickham_3
Occasional Contributor

Re: Submit Very Basic System administration commands and win easily points

To Unlock a trusted account
/usr/lbin/modprpw -k
Unix Systems administrator