Operating System - HP-UX
1821257 Members
3011 Online
109632 Solutions
New Discussion юеВ

HPUX reboot at the last| reboot

 
furrah
Occasional Advisor

HPUX reboot at the last| reboot

Am not sure if I had any luck finding any tread that had this problem. If any of you could enlight me on this it would help me allot.

We are supporting large number of HPUX systems with various Model and Version. I have encounter some issue with the command "last" . Namely -

#last | reboot

This has caused the system to reboot as soon as the command was entered. The technican that was working on the system was suprise to simple mistake he has done with the incomplete of the command (#last | grep reboot) had caused the system to reboot.

I was told there is a problem using the command the way it is used (last | reboot). Can anyone help me to rectify this issue. I am affraid we might use the command again accidently again in the future and might cause the system to reboot once more. Many thanks
8 REPLIES 8
Robert-Jan Goossens
Honored Contributor

Re: HPUX reboot at the last| reboot

Hi,

I think you are looking for the lat reboot.

# lst | grep reboot

Robert-Jan
Robert-Jan Goossens
Honored Contributor

Re: HPUX reboot at the last| reboot

typo!
# last | grep reboot
furrah
Occasional Advisor

Re: HPUX reboot at the last| reboot

Yes you are right, the command to use is "last | grep reboot", but the techican had use it wrongly hence he use it as "last |reboot" accidently and caused the system to reboot.

How can i eliminate this from happening.
Dennis Handly
Acclaimed Contributor

Re: HPUX reboot at the last| reboot

>How can i eliminate this from happening.

No good ways except by learning from your lessons. :-(
Take away root access from that user.
Or remove /usr/sbin from PATH.
RobinKing
Valued Contributor

Re: HPUX reboot at the last| reboot

Is this Operator using root? If so I'd suggest maybe he/she doesn't.
I'd look at sudo if this person still needs elevated rights, but you want to stop them rebooting the server.

Re: HPUX reboot at the last| reboot

reminds me of the old joke:

Patient: it hurst when I do THIS!

Doctor: Well don't do THAT then!

You may as wll say - "I drove my car the other day, and crashed it into a wall! How can I stop that happening?" - the choices are limited - driver safer or don't drive, but if you are going to drive, there's always some chance you'll crash into another wall...

In all seriousness, if this person can't be trusted to not make such mistakes, you should consider revoking root access for that person, or at least 're-training'.

Good practice says you do everything as a normal user and only access root when you know you have to. Incidentally in this case, you didn't need to be root to use that last command - here's one from my workstation logged in as oracle:

$ last | grep reboot
reboot system boot Mon Jul 23 13:02 still logged in
reboot system boot Fri Jul 20 11:14 - 13:02 (3+01:47)
reboot system boot Thu Jul 19 08:21 - 11:14 (1+02:53)


And if I made the same mistake when not logged in as root:

$ last | reboot
sh: reboot: not found.

OK - trying really hard to do something stupid now:

$ /usr/sbin/reboot
reboot: You are not super-user. Sorry.

So you see - if I stay logged in as this user, most commands will tell me if I need to be root to use.

In short "restrict and educate!"

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Yogeeraj_1
Honored Contributor

Re: HPUX reboot at the last| reboot

hi,

You should indeed review the privileges of that technician!!

Seriously, caution should always be exercised when running commands containing "reboot", "shutdown" and "rm"

You may also wish to use:
# last |grep "reboot"
reboot system boot Sun Jul 8 23:54 still logged in
reboot system boot Sat Jun 9 04:15 - 23:54 (29+19:39)
#

Anyway, users else than users with root privileges can also issue: last |grep reboot


bad luck!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
furrah
Occasional Advisor

Re: HPUX reboot at the last| reboot

Thank you for the great input, nonetheless all of your input moretheless the same.

Coution should be used while driving, yes Duncan I agree, here onwards.