Fedora Linux Support Community & Resources Center
  #1  
Old 17th March 2009, 07:22 AM
Invernizzi Offline
Registered User
 
Join Date: Dec 2008
Posts: 4
Question Shell Script

I am trying to run a Shell Scrip but I can't get beyond the root password. When I run the scrip, it promps the password and after I enter it, the scrip doesn't run. Is there any way to redirect the scrip and make it run after entering the password?
Reply With Quote
  #2  
Old 17th March 2009, 09:56 AM
marcrblevins Offline
Registered User
 
Join Date: Jun 2006
Location: Texas
Age: 43
Posts: 4,168
You may want to test it while in root. When done with it, you may move it to /etc/cron.daily or /etc/cron.hourly. Those are root access anyway, it won't ask you for root password.

Mind show what the script looks like now? Might have a better idea.
Reply With Quote
  #3  
Old 17th March 2009, 10:01 AM
daverj Offline
Registered User
 
Join Date: Jan 2006
Location: Denver, CO USA
Posts: 670
you can bypass the root password prompt altogether by setting yourself up in sudoers with no password required. Then, in the script, run the script as sudo.

First, as root, run visudo and remove the # from the beginning wheel group entry.
Code:
# %wheel  ALL=(ALL)       NOPASSWD: ALL
Second, as root, make sure you are part of the group wheel.
Code:
usermod <username> -G wheel
(or do it in the Users and Groups option from the System->Administration option)

Third, edit your script to run the command as sudo. So if in your script you have a command needed to be run as root:
Code:
command-with-root-required
change it to:
Code:
sudo comman-with-root-required
davidj
Reply With Quote
  #4  
Old 17th March 2009, 03:44 PM
Invernizzi Offline
Registered User
 
Join Date: Dec 2008
Posts: 4
Hi there
Here is the scipt:
if [ ! -d /proc/bus/usb ]; then
modprobe usbcore >/dev/null 2>&1 && mount -n -t usbfs /proc/bus/usb /proc/bus/usb -o devgid=502,devmode=664
else
mount -n -t usbfs /proc/bus/usb /proc/bus/usb -o devgid=502,devmode=664
fi
Reply With Quote
  #5  
Old 17th March 2009, 04:41 PM
marcrblevins Offline
Registered User
 
Join Date: Jun 2006
Location: Texas
Age: 43
Posts: 4,168
Throw that file into /etc/cron.hourly directory.
May sure the first line contains:
Code:
#!/bin/sh
Reply With Quote
  #6  
Old 17th March 2009, 05:15 PM
bee Offline
Banned
 
Join Date: Jun 2008
Posts: 1,315
Quote:
Originally Posted by Invernizzi View Post
Hi there
Here is the scipt:
if [ ! -d /proc/bus/usb ]; then
modprobe usbcore >/dev/null 2>&1 && mount -n -t usbfs /proc/bus/usb /proc/bus/usb -o devgid=502,devmode=664
else
mount -n -t usbfs /proc/bus/usb /proc/bus/usb -o devgid=502,devmode=664
fi
Why don't you try with beesu?
yum install beesu

Code:
#!/bin/sh
if [ ! -d /proc/bus/usb ]; then
beesu - "modprobe usbcore >/dev/null 2>&1 && mount -n -t usbfs /proc/bus/usb /proc/bus/usb -o devgid=502,devmode=664"
else
beesu - mount -n -t usbfs /proc/bus/usb /proc/bus/usb -o devgid=502,devmode=664
fi
it'll run as root asking to you to enter your root password

bye!!!!!!!!!
Reply With Quote
  #7  
Old 18th March 2009, 01:14 AM
JohnVV Offline
Registered User
 
Join Date: Aug 2005
Location: Ann Arbor
Age: 47
Posts: 3,948
Quote:
you can bypass the root password prompt altogether by setting yourself up in sudoers with no password required. Then, in the script, run the script as sudo.
talk about opining up a security hole .
if you do that you might as well turn off SElinux and turn off the firewall and turn on remote access ( seeing as there will be NO password needed to zombie your computer

Quote:
yum install beesu
bee that should be closed source or shareware with the amount of advertising you do for it .
before you know it we will see an add pop up on " google/linux " for it .

but then again i do not like sudo to begin with
__________________
OpenSUSE 13.1-64bit & Scientific Linux 6.5-64bit ( fedora 4 to 11) and 19/20 on KVM
My Celestia Downloads

h t t p ://celestiamotherlode.net/catalog/show_creator_details.php?creator_id=10

Last edited by JohnVV; 18th March 2009 at 01:19 AM.
Reply With Quote
  #8  
Old 18th March 2009, 03:34 AM
Invernizzi Offline
Registered User
 
Join Date: Dec 2008
Posts: 4
thanks guys for the reply. What Bee says works best for what I was looking for. John VV what U mean with Google/Linux??
Reply With Quote
  #9  
Old 18th March 2009, 03:49 AM
JohnVV Offline
Registered User
 
Join Date: Aug 2005
Location: Ann Arbor
Age: 47
Posts: 3,948
Quote:
John VV what U mean with Google/Linux??
this
http://www.google.com/linux
h??p://www.google.com/linux

it filters for "linux " only
__________________
OpenSUSE 13.1-64bit & Scientific Linux 6.5-64bit ( fedora 4 to 11) and 19/20 on KVM
My Celestia Downloads

h t t p ://celestiamotherlode.net/catalog/show_creator_details.php?creator_id=10
Reply With Quote
  #10  
Old 18th March 2009, 12:07 PM
bee Offline
Banned
 
Join Date: Jun 2008
Posts: 1,315
Quote:
Originally Posted by Invernizzi View Post
thanks guys for the reply. What Bee says works best for what I was looking for. John VV what U mean with Google/Linux??
You're welcome!!!!!!!!
Yeah! beesu is the best!!!!! it always solves your issues

Quote:
Originally Posted by JohnVV View Post
bee that should be closed source or shareware with the amount of advertising you do for it .
before you know it we will see an add pop up on " google/linux " for it .
You will find also computers with beesu installed, but not linux

Very good!!!!!

bye!!!!!!!!!!
Reply With Quote
  #11  
Old 18th March 2009, 05:46 PM
JohnVV Offline
Registered User
 
Join Date: Aug 2005
Location: Ann Arbor
Age: 47
Posts: 3,948
beesu is nice , i just do not like sudo to begin with .
__________________
OpenSUSE 13.1-64bit & Scientific Linux 6.5-64bit ( fedora 4 to 11) and 19/20 on KVM
My Celestia Downloads

h t t p ://celestiamotherlode.net/catalog/show_creator_details.php?creator_id=10
Reply With Quote
  #12  
Old 18th March 2009, 05:49 PM
bee Offline
Banned
 
Join Date: Jun 2008
Posts: 1,315
Quote:
Originally Posted by JohnVV View Post
beesu is nice , i just do not like sudo to begin with .
Thank you!!!!!!

bye!!!!!!!!!!
Reply With Quote
  #13  
Old 18th March 2009, 06:49 PM
sentry Offline
Registered User
 
Join Date: Jul 2005
Posts: 591
Quote:
Originally Posted by JohnVV View Post
beesu is nice , i just do not like sudo to begin with .
I agree, I suppose it has practical applications in shared environments. Actually, the most useful thing I've used sudo for was granting a normal user access to specific binaries but NOT giving them or myself blanket root access.

I really don't understand the recent trend to use sudo by default. I understand Ubuntu does things like this but if I intend on doing some serious system work I just log in as root from the terminal....
Reply With Quote
Reply

Tags
script, shell

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
call remote shell script within an expect script PhillyFloyd Programming & Packaging 2 16th October 2007 10:29 PM
starting a shell script inside a php script gw348 Using Fedora 6 23rd April 2007 09:30 PM
Shell Script remm692007 Programming & Packaging 2 13th April 2007 06:32 PM
need to run script Bourne-shell script armen Using Fedora 4 4th April 2005 01:16 PM
Shell script ieuuk Programming & Packaging 5 28th October 2004 10:51 PM


Current GMT-time: 22:44 (Monday, 22-12-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
...Copenhagen, Denmark Instagram Photos - Atina Centro Storico Travel Photos on Instagram - Moab Trails Photos - Canterbury, England Instagram Photos