Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
04-05-2006, 05:32 PM
|
#1
|
|
LQ Newbie
Registered: Apr 2006
Distribution: Ubuntu 5.10 (Breezy)
Posts: 3
Rep:
|
How to tell shell script a password?
I'm running Ubuntu (Breezy) and I need to execute a 'sudo' command at startup. I don't think it will work through the "startup programs" window because sudo requires a password. So I want to write a shell script that I can just execute manually at startup. But how do I tell it what my password is so it can answer the Password prompt? Thanks!
|
|
|
|
04-05-2006, 05:47 PM
|
#2
|
|
Guru
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that.
Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,697
Rep:
|
If all you need to do is one command I would edit /etc/sudeors file. You have to use ' visudo ' command to edit the file. In it I assume there is a section like this.
# Uncomment to allow people in group wheel to run all commands
%wheel ALL=(ALL) ALL
You can it to this so as not to need to use a passwd ever again. ( not the best idea )
# Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
Or just allow a single or a few commands to execute without roots password.
username ALL=NOPASSWD: /sbin/ifdown, /sbin/mount
Brian1
|
|
|
|
04-05-2006, 06:18 PM
|
#3
|
|
LQ Newbie
Registered: Apr 2006
Distribution: Ubuntu 5.10 (Breezy)
Posts: 3
Original Poster
Rep:
|
I used your last suggestion and it did the trick for me. Many thanks!
|
|
|
|
04-05-2006, 06:41 PM
|
#4
|
|
Guru
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that.
Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,697
Rep:
|
Yes the last one would be more secure. This way it limits the cammands you can do this way. The second one would work as long as you never add other users to the wheel group. Kind of gives you full root anytime with only the need to add sudo before the command to execute.
Brian1
|
|
|
|
04-05-2006, 07:39 PM
|
#5
|
|
LQ Addict
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320
Rep:
|
If it's something that can be run before a user logs on, you can add it to your local boot script (/etc/boot.local or something similar). This script is run as root, so sudo is not necessary.
If it's a command that needs to be run in a graphical environment, then it won't work this way.
|
|
|
|
04-05-2006, 09:16 PM
|
#6
|
|
LQ Newbie
Registered: Apr 2006
Distribution: Ubuntu 5.10 (Breezy)
Posts: 3
Original Poster
Rep:
|
Cool, thanks! Hopefully I can figure out BUM for that, or something.
edit - turns out to be "or something" 
Last edited by Etoile; 04-05-2006 at 09:24 PM.
|
|
|
|
| Thread Tools |
Search 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
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:03 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|