LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 09-29-2008, 07:33 AM   #1
unix_anand
LQ Newbie
 
Registered: Dec 2004
Location: Mumbai - India
Posts: 9
Blog Entries: 1

Rep: Reputation: 0
How to give root access to normal user for one day.


Hello everybody,

I have one problem.
We are using RHEL5 with 100 of users. Now I want to give root access for shutdown machine and restart the services to one of the normal user. I feel giving root password to normal user is not correct way, If I use ACL or sudo but that not for single day this will continue for next day till I disable sudo. Is it possible to give sudo permission for single day upto given time means with in office hours.

Anybody has any solution or similar answer please please please
reply me.

Thanks and regards,

Anand.
 
Old 09-29-2008, 07:41 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Why not write a script which modifies the sudo config file(s) based on the time of day? Assuming you know the commands for setting up sudo, all you need is a loop that checks time every minute or so, and then runs the right command sequence.
 
Old 09-29-2008, 01:18 PM   #3
lukav
Member
 
Registered: Sep 2008
Distribution: Slackware & Ubuntu
Posts: 39

Rep: Reputation: 15
One way to do this -

To grant access to user1 to poweroff and start/stop/restart other services, edit /etc/sudoers with the following:
Code:
user1   ALL=/sbin/poweroff, [other programs to start/stop/restart services]

To remove user1 line from /etc/sudoers, create shell script:
Code:
#!/bin/bash
mv /etc/sudoers /etc/sudoers.old
cat /etc/sudoers.old | sed '/user1/d' > /etc/sudoers

chmod +x to created script

To execute above script at end of business day, type the following at the command shell:
Code:
sudo at 5pm
[full path and name of created script]
^D

Last edited by lukav; 10-01-2008 at 05:40 PM. Reason: improve readability
 
Old 10-14-2008, 05:45 AM   #4
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Quote:
cat /etc/sudoers.old | sed '/user1/d' > /etc/sudoers
is not without risk. Assume there is a user called "user12"...
Better make sure you match the first word in the line exactly.

Quote:
a loop that checks time every minute or so
this is what cron & "at" command do for you...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to give root privileges to normal user? caedo Linux - Newbie 11 08-28-2008 03:15 PM
providing the root access to normal user raghuvamsi Linux - General 3 06-11-2008 12:38 AM
How can give ROOT permission to a NORMAL USER bipinkdas Linux - Software 2 06-23-2005 11:03 PM
Give Root Access To A Normal User waknauss Linux - Security 2 11-11-2004 09:00 AM
how to give a normal user access to cd burning? zero79 Debian 2 08-14-2004 08:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration