UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 11th, 2005, 11:12 AM
robbrown robbrown is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 353 robbrown User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 32 m 55 sec
Reputation Power: 7
Multiple User Shell Script

I would like to make a shell script that will be run as root.

This shell script will su into various users and then run commands as them. sudo won't work.

eg:

su username1
runcommand
sleep 5
exit
su username2
runcommoand
sleep 5
exit
.
:

Any help is greatly appreciated.

Reply With Quote
  #2  
Old October 11th, 2005, 12:21 PM
LinuxPenguin's Avatar
LinuxPenguin LinuxPenguin is offline
fork while true;
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2005
Location: England, UK
Posts: 5,535 LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)  Folding Points: 11590 Folding Title: Novice Folder
Time spent in forums: 1 Month 3 Weeks 1 Day 19 h 30 m 28 sec
Reputation Power: 1008
Quote:
Originally Posted by robbrown
I would like to make a shell script that will be run as root.

This shell script will su into various users and then run commands as them. sudo won't work.

eg:

su username1
runcommand
sleep 5
exit
su username2
runcommoand
sleep 5
exit
.
:

Any help is greatly appreciated.
I dont see a question?

Reply With Quote
  #3  
Old October 11th, 2005, 02:09 PM
stdunbar stdunbar is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: May 2004
Location: Superior, CO, USA
Posts: 1,730 stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 23 h 23 m 44 sec
Reputation Power: 375
Send a message via ICQ to stdunbar Send a message via Yahoo to stdunbar
Do a man on the su command. You'll want to use "su -c".
__________________
Need Java help? Want to help people who do? Sit down with a cup of Java at the hotjoe forums.

Reply With Quote
  #4  
Old October 21st, 2005, 06:22 AM
robbrown robbrown is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 353 robbrown User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 32 m 55 sec
Reputation Power: 7
Thanks for your help stdnbar! That worked great!!

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Multiple User Shell Script


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT