Admin privileges check


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Admin privileges check
# 1  
Old 03-27-2008
Question Admin privileges check

I've been tasked to check whether the user of a script has administrative privileges (as they are needed to run certain parts of the script), and if not notify the user to run the script with admin privileges.

Since the script is to be widely distributed, controlling the file rights will not be sufficient.

Any ideas on how to script this check?

Note: I have a couple ideas, but I don't want this to be a hack.
# 2  
Old 03-27-2008
Hard-coding a particular check which is not relevant for the privileges actually required for the script to work sounds like an annoying feature. Can you check for ability to manipulate those resources which the script will actually need to manipulate? Then it's easier to plonk in to alternate access control systems.
# 3  
Old 03-27-2008
Tools Nope... requirements must stand.

I like the way you think... but these are customer requirements against a script that cannot be subjected to various changes...

I was going to perform a check on a task only admin can do, then return the message if it fails.

However, I was looking for a more direct means.
# 4  
Old 03-27-2008
You said you didn't want ad-hockery but here goes anyway. I usually just check for write access to the root directory in my own little admin scripts.
# 5  
Old 03-27-2008
MySQL Thanks!

Excellent! Thanks!

If it's not too much to ask, can you post how you do it? Otherwise, I'll work it out.

Thanks again.
# 6  
Old 03-27-2008
Code:
test -w /

Dang, have to add length to get to post this reply (-:
# 7  
Old 03-27-2008
Hammer & Screwdriver Thanks again!

Does the trick ( with a bang ) Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. What is on Your Mind?

Regarding Admin life either as DBA or UNIX Linux admin

I am planning to choose my career as Unix/Linux Admin or a DBA. But I have come to know from forums and few admins like the job will be 24/7. I have few questions on that. Can we get "DAY" shifts in any one of the admin Job ? Can't we have shift timings in any company ? Eventhough the... (7 Replies)
Discussion started by: Jacktts
7 Replies

2. UNIX for Dummies Questions & Answers

Command run with admin privileges

Hi all, I want to run a single command (gdm-restart) which has admin privileges as normal user. I have done these below steps so for. 1. cp -p /usr/sbin/gdm-restart /usr/bin 2. chmod o+w /usr/bin 3. chown user /usr/bin. But still not success. So kindly please let me know whether there is... (3 Replies)
Discussion started by: mastansaheb
3 Replies

3. What is on Your Mind?

Windows Admin switching to *nix Admin

I'm currently a Windows admin and have wanted to jump ship to the *nix side for a while now. I've been studying both through an lpic level 1 manual as I have time (focusing on debian), and a solaris 10 cert book. The problem is I only have a handful of hours a week to study, and my current job... (3 Replies)
Discussion started by: bobwilson
3 Replies

4. Windows & DOS: Issues & Discussions

Lost Domain Admin Privileges in Samba

Hello, I have apparently lost all domain admin privledges in Samba. I have had several problems ever since I installed the 1/31 Solaris patch cluster. I had to roll out one Samba update (146363-01), which denied all logons network access. However, this particular problem seems to have begun... (0 Replies)
Discussion started by: stringman
0 Replies

5. AIX

copy a fs with the same privileges

Hi All, I use "cp -R /fs/* /newfs" and I can copy everything except it won't have the files/directories the same privileges. Is there a trick to this without using a software-backup. Thanks in advance, itik (3 Replies)
Discussion started by: itik
3 Replies

6. UNIX for Dummies Questions & Answers

root privileges

Hello, As admin with root rights, to execute any command from another user without password-ask, I do : su - <user> -c "<cmd>" But how can I do to give the same rights to another physical user without using root user ? :confused: I've try to create another user "toor" with the same primary... (4 Replies)
Discussion started by: madmat
4 Replies

7. Programming

root privileges

Hi I have make a program that needs root privleges but any user can try to run it, so what I want it is, when any user tries( other than root ) to run the program, an input prompt would open to enter root password ( if user knows ) and program will run ( otherwise exit ), and after completing... (21 Replies)
Discussion started by: sumsin
21 Replies

8. UNIX for Dummies Questions & Answers

privileges

I have a website that I am working on and one of the pages allows people to upload pictures to be used on other pages. My question is: is it safe to set the privileges to 777 on the folder that the pictures are saved in? Or would that open up my site to be hacked, bugged, wormed...and everything... (1 Reply)
Discussion started by: paladaxar
1 Replies
Login or Register to Ask a Question