Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 23rd January 2008, 01:51 PM
imfromwales Offline
Registered User
 
Join Date: Dec 2007
Posts: 114
Entering su password in a script

my script needs to be ran as root. In the script i have su to change to root but how do i say what the password is, in the script...i.e. automatically enter the root password?

or at least once the root password has been entered, continue with the rest of the script.
__________________
" Choose a job. Choose a career. Choose a family.
Choose life."

After installing a 40gbps network, they said:
"The most difficult part of the whole project was installing Windows on Sigbritt's PC,"
- http://www.thelocal.se/7869/20070712/
Reply With Quote
  #2  
Old 23rd January 2008, 01:58 PM
Evil_Bert's Avatar
Evil_Bert Offline
Retired Again - Administrator
 
Join Date: Nov 2007
Location: Reality
Posts: 3,034
Probably best to use 'sudo' instead and add the scripts and/or commands to the /etc/sudoers file.

See my example in this thread to give you an idea.

Sudo scripts
__________________
.
Marching to the beat of his own conundrum.
Reply With Quote
  #3  
Old 23rd January 2008, 02:03 PM
imfromwales Offline
Registered User
 
Join Date: Dec 2007
Posts: 114
thanks a lot
__________________
" Choose a job. Choose a career. Choose a family.
Choose life."

After installing a 40gbps network, they said:
"The most difficult part of the whole project was installing Windows on Sigbritt's PC,"
- http://www.thelocal.se/7869/20070712/
Reply With Quote
  #4  
Old 23rd January 2008, 02:43 PM
imfromwales Offline
Registered User
 
Join Date: Dec 2007
Posts: 114
Ok. I have a script which imply pings google (im lazy, i cant be bothered to open a terminaal then manually ping it). The script works fine, apart from when i add it to a custom application launcher, it does not work.

When i double click the script, it asks me how i want to open it (run in terminal, display, cancel run), even though i have checked the box to make it an executable and said i want it to open in the gnome terminal (Properties > Open with > Add > Use custom command. The custom command i use is gnome-terminal which is the correct command to run the gnome terminal.)

Does anybody know how to make a script open in the terminal, once you have added it to a custom launcher on the taskbar?
__________________
" Choose a job. Choose a career. Choose a family.
Choose life."

After installing a 40gbps network, they said:
"The most difficult part of the whole project was installing Windows on Sigbritt's PC,"
- http://www.thelocal.se/7869/20070712/
Reply With Quote
  #5  
Old 23rd January 2008, 02:59 PM
Evil_Bert's Avatar
Evil_Bert Offline
Retired Again - Administrator
 
Join Date: Nov 2007
Location: Reality
Posts: 3,034
Did you read the whole example, including Step 3?
__________________
.
Marching to the beat of his own conundrum.
Reply With Quote
  #6  
Old 23rd January 2008, 03:04 PM
sej7278 Offline
Registered User
 
Join Date: Sep 2004
Posts: 2,008
gnome-terminal -e or -x should work, doesn't seem to work for me.....
Reply With Quote
  #7  
Old 23rd January 2008, 03:08 PM
imfromwales Offline
Registered User
 
Join Date: Dec 2007
Posts: 114
yes i did. I tried adding sudo at the start of the command but that did not do anything.

I thought of this but it does not run the ping, nor does it change the directory, it only opens the terminal.

Code:
gnome-terminal
cd /home/Antonio/documents/misc/scripts
ping.sh
__________________
" Choose a job. Choose a career. Choose a family.
Choose life."

After installing a 40gbps network, they said:
"The most difficult part of the whole project was installing Windows on Sigbritt's PC,"
- http://www.thelocal.se/7869/20070712/
Reply With Quote
  #8  
Old 23rd January 2008, 03:18 PM
Zero-Override Offline
Registered User
 
Join Date: May 2005
Posts: 741
you should look at these as batch files, it does step one, when it gets an exit or completesignal it moves on

you first tell it to run gnome-terminal, it does that but since it it still running it won't move down the ladder to the next commands

it might be better to implement it in your ping.sh and then call that in a terminal
__________________
LINUX NUMBER 389596
machine number 290131
Reply With Quote
  #9  
Old 23rd January 2008, 03:19 PM
Evil_Bert's Avatar
Evil_Bert Offline
Retired Again - Administrator
 
Join Date: Nov 2007
Location: Reality
Posts: 3,034
If I read you right, you're trying to open terminal within the script? You don't need this - just the guts of the script (as if you were typing it in a terminal that's already open).

"sudo" is for scripts (or other commands) to be run as root. There must be a corresponding entry in /etc/sudoers.

Did you select type "Application in Terminal" in the launcher properties?

So, the basic steps:
1. Create the script, put it somewhere accessible, make it executable/SELinux-compliant
2. If run as root, add to sudoers
3. Create launcher to run the script (and only the script), add sudo only if a root script
__________________
.
Marching to the beat of his own conundrum.
Reply With Quote
  #10  
Old 23rd January 2008, 08:51 PM
imfromwales Offline
Registered User
 
Join Date: Dec 2007
Posts: 114
thanks for the info people
gnome-terminal -e or -x does not work.

I have it working now though. Thanks for all your help guys

One more question....the icons are .svg files? does anybody know of any good sites for these? or where i can find them on my system apart from the limited supply in:
/usr/share/icons/hicolor/scalable/apps/gnome-panel-launcher.svg
__________________
" Choose a job. Choose a career. Choose a family.
Choose life."

After installing a 40gbps network, they said:
"The most difficult part of the whole project was installing Windows on Sigbritt's PC,"
- http://www.thelocal.se/7869/20070712/
Reply With Quote
  #11  
Old 23rd January 2008, 09:08 PM
Zero-Override Offline
Registered User
 
Join Date: May 2005
Posts: 741
well firstly, post your solution so others can be helped from it to

secondly, try Gimp for saving something in a different format, there is a chance it will allow for svg, if not, try yum search svg or something like that
__________________
LINUX NUMBER 389596
machine number 290131
Reply With Quote
  #12  
Old 23rd January 2008, 09:12 PM
Mariano Suárez-
Guest
 
Posts: n/a
What do you mean by "gnome-terminal -e or -x does not work."?
Reply With Quote
  #13  
Old 23rd January 2008, 09:59 PM
imfromwales Offline
Registered User
 
Join Date: Dec 2007
Posts: 114
sej7278 sugessted it
__________________
" Choose a job. Choose a career. Choose a family.
Choose life."

After installing a 40gbps network, they said:
"The most difficult part of the whole project was installing Windows on Sigbritt's PC,"
- http://www.thelocal.se/7869/20070712/
Reply With Quote
  #14  
Old 23rd January 2008, 10:33 PM
Bslagowski's Avatar
Bslagowski Offline
Registered User
 
Join Date: Dec 2007
Location: Wisconsin
Posts: 196
You can also use PNG files as icons .. possibly even others. There are other icons in /usr/share/pixmaps and /usr/share/icons (and its sub-folders). Probably other places as well.
__________________
So dawn goes down to day,
Nothing gold can stay.
Reply With Quote
  #15  
Old 23rd January 2008, 10:36 PM
Mariano Suárez-
Guest
 
Posts: n/a
I know. When you said that it does not work, what did you try?

For example, both
Code:
gnome-terminal --working-directory /tmp -x ping www.google.com
or
Code:
gnome-terminal -e "sh -c 'cd /tmp;ping www.google.com'"
work, AFAICT.
Reply With Quote
Reply

Tags
entering, password, script

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
Redirected back to the login screen after entering Username and paSSword dkd903 Using Fedora 1 5th April 2008 09:09 AM
Entering security password bopmatic Servers & Networking 5 29th September 2007 02:37 AM
i can start apps with root-privilages without entering the password pepe123 Security and Privacy 7 21st June 2007 04:53 PM
Boot without entering Password homeworx Using Fedora 5 13th October 2005 04:27 AM
password script in python kronedawg Programming & Packaging 1 8th September 2004 09:21 PM


Current GMT-time: 07:39 (Monday, 20-05-2013)

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