1833750 Members
2653 Online
110063 Solutions
New Discussion

diskinfo without root?

 
SOLVED
Go to solution
A. Daniel King_1
Super Advisor

diskinfo without root?

Is there a good way to get at diskinfo-type data without being root?

I can write a SUID wrapper, but I'd like to know if there are any utilities inherent to HP-UX 11.0 - without opening potential security holes.

Thanks!
Command-Line Junkie
6 REPLIES 6
Michael Tully
Honored Contributor

Re: diskinfo without root?

Hi,

Why not setup 'sudo'? It is really easy and everything can be logged for a user that has only access to specific tasks.

You can get it here:

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/sudo-1.6.2b1/

As an example for 'diskinfo' in the /etc/sudoers file could be:

# Host alias specification

# User alias specification
User_Alias OPS = joe

# Cmnd alias specification
Cmnd_Alias OPS = /usr/sbin/diskinfo

# User privilege specification
OPS ALL=(ALL) ALL


HTH
~Michael~
Anyone for a Mutiny ?
A. Daniel King_1
Super Advisor

Re: diskinfo without root?

Good point. I've got sudo, but I'm trying to dig into HP-UX specifically. I may end up doing exactly as you suggest. However, I'm running diskinfo in a script, with loops, many disks, and I've seen loops (calling sudo) create *huge* log files. Maybe this is the only way (or just running it as root).
Command-Line Junkie
James R. Ferguson
Acclaimed Contributor

Re: diskinfo without root?

Hi:

Here's a viewpoint only. If you''re dealing with 'diskinfo' and the LVM configuration at large, you probably need/want to be root in the first place. After all, as an administrator do you really want to "sub-out" these kinds of critical tasks?

Regards!

...JRF...
S.K. Chan
Honored Contributor
Solution

Re: diskinfo without root?

There is a "roundabout" way to get the "diskinfo type" output as ordinary user by using cstm. I've tried it and it works. Here goes (you may/may-not want to use this way)..
Assuming c2t6d0 ..
$ /etc/lssf /dev/rdsk/c2t6d0|awk '{print $15}'
10/0/15/0.6.0
Take this path and pass it to cstm..
$ echo "sel path 10/0/15/0.6.0;info;wait;infolog
> view
> done
> " | /usr/sbin/cstm > disk-info
Now if you look a the file it has the info you that "kindda" similar to diskinfo output. You just need to extract what you need from the file.
Steven Sim Kok Leong
Honored Contributor

Re: diskinfo without root?

Hi,

If you want it to be specifically HP-UX, try restricted sam

# /usr/sbin/sam -r

You can put diskinfo in a script with $1 parameter as the disk. Then add the script to sam and subsequently assign user privileges and allowable access to the script in sam.

Your user just needs to run (if /usr/sbin already in PATH):

# sam

Otherwise:

# /usr/sbin/sam

man 1m sam for more information.

Hope this helps. Regards.

Steven Sim Kok Leong
A. Daniel King_1
Super Advisor

Re: diskinfo without root?

I have the basic philosophy of 'if it can be done without root, do it without root.'

Especially when it comes to my own fat fingers.

Thanks for the replies. cstm looks like something I need to learn.
Command-Line Junkie