Operating System - HP-UX
1753914 Members
9189 Online
108810 Solutions
New Discussion юеВ

run /usr/sbin/dmesg with a limited user account - no root

 
googler80
Occasional Advisor

run /usr/sbin/dmesg with a limited user account - no root

Hello guys, this is my first post here, I hope someone can help me to resolve this issue.

I have an HP-UX box, and i need to run the dmesg command located in /usr/sbin. This command should be run using a limited user, permissions are given to everyone on that command, but it seems it goes to read from the kernel. could anyone help, how to make it possible to run this command with a specific user without giving him hight privileges ?


here is the output:

==============================
bash$ /usr/sbin/dmesg

Jul 14 14:04
Can't read kernel memory
==============================


Thanks guys
16 REPLIES 16
Ivan Krastev
Honored Contributor

Re: run /usr/sbin/dmesg with a limited user account - no root

Use sudo to assign privileges for running dmesg command.

regards,
ivan
James R. Ferguson
Acclaimed Contributor

Re: run /usr/sbin/dmesg with a limited user account - no root

Hi:

What information are you *rally* trying to discern from 'dmesg'?

Regards!

...JRF...
googler80
Occasional Advisor

Re: run /usr/sbin/dmesg with a limited user account - no root

memory information, but it is not me who is trying to get this information :)
it is my system, it is a monitoring system, and it runs this command to get information related to the memory capacity and memory utilization.

file permissions or dmesg allows all users to run the file:

$ ls -l /usr/sbin/dmesg
lrwxr-xr-x 1 root sys 11 Feb 13 2002 dmesg -> /sbin/dmesg

$ ls -l /sbin/dmesg
-r-xr-xr-x 1 bin bin 212992 Nov 14 2000 /sbin/dmesg


So the rights are given to everybody to run the file, but it seems a part of this command tries to read the kernel which is not allowed to my user.
Ivan Krastev
Honored Contributor

Re: run /usr/sbin/dmesg with a limited user account - no root

dmesg is using the kernel buffers - that was the reason for root account.
You can use crontab to schedule dmesg entries to be written into separate file - http://docs.hp.com/en/B3921-90010/dmesg.1M.html


regards,
ivan
James R. Ferguson
Acclaimed Contributor

Re: run /usr/sbin/dmesg with a limited user account - no root

Hi (again):

I suspected that is was memory information that you wanted. Why, is still unclear, but:

# echo "selclass qualifier memory;info;wait;infolog"|cstm > /var/tmp/meminfo

Regards!

...JRF...
googler80
Occasional Advisor

Re: run /usr/sbin/dmesg with a limited user account - no root

Thanks for your replies guys, and many thanks for the command,
but I really need the user to run that specific command as I cannot change in the source code of the monitoring system to use the other command.
besides, it still needs to calculate percentage of utilizewd memory.
I need to let a user run /usr/sbin/dmesg

Thanks guys
Dennis Handly
Acclaimed Contributor

Re: run /usr/sbin/dmesg with a limited user account - no root

>but I really need the user to run that specific command

Be aware that dmesg will NOT have this info if the system has been up for some time.
Patrick Wallek
Honored Contributor

Re: run /usr/sbin/dmesg with a limited user account - no root

To expand on what Dennis said --

dmesg is a circular buffer of messages. Once the buffer is full, older messages will disappear as newer messages are received.

So, eventually you will NOT be able to find your memory info is the dmesg buffer.

You really need to look for an alternate means to get the information you need.
Torsten.
Acclaimed Contributor

Re: run /usr/sbin/dmesg with a limited user account - no root

Don't how you want to get the amount of utilized memory with dmesg, but anyway, consider to setup sudo to enable the user to run dmesg.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!