Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How do you setup a cron job to setup eth0 IP configuration via dhcp. I can manually do it as root using
#ifup eth0
Determininf IP information for eth0...done.
I need to run a database update program which needs an internet connection. I am trying to run mythfilldatabasecron (if anyone of you is aware of the mythtv program). I added a line to the beginning of my cron file:
#!/bin/bash
/sbin/ifup eth0 ( I added this)
/usr/local/bin/mythfilldatabase (this is the program that needs to run after I have established an network connection to my IP masquerading server)
The second part of the script works but the first part does not and linux complains." Users cannot control this device" when it attempts to execute ifup eth0 in the script. I understand that it needs root privileges. However I am not going to be sitting in the front of the screen to enter a password. Is there a way to make ifup eth0 work on a user cron script ? If not, how can I make sure that there is an active eth0 connection to the IP masqueradeing server before cron executes mythfilldatabase. My IP masquearading server is set up for dial on demand so any network connection to it directed to the internet will open up ppp0.
I need to ifup eth0 prior to mythfilldatabase because eth0 goes down after a specified lease time. I have this PC running all the time (It is setup as a Tivo Like personal video recorder in Linux).
A couple of options
1: put it in roots crontab
2: configure sudo to allow the user running the script to perform the ifup, then just change the command to sudo ifup eth0
Thanks. I was able to set up a root cron job that does ifup eth0. It works now. I was wondering if you can tell me how to setup a user with sudo so the user can copy a modified XF86Config-4. I have 2 XF86Config-4 files. One for TV output. The other for Monitor output. I have a script that allows a user to copy either of these XF86config versions over XF86Config-4 but it does so by giving the user all the root privileges ( well I am the user and I am the root also anyway). I did this by editing /etc/sudoers and inserting username ALL=(ALL) ALL under the entry for root in the section User privilege specification. I want to do it properly so that I dont destroy anything accidentally logged as user.
Okay, since you already have the script, make it owned by root.
You'll have to setup a command alias for your script and assign the user(s) into a group which is allowed to sudo it
something like
-------------------------------------------------------------------
User_Alias XMODUSERS=user_1,user_2 .... user_n
...
Cmnd_Alias XCONFSCRIPT=/full/path/to/your/script
...
XMODUSERS ALL = NOPASSWD: XCONFSCRIPT
--------------------------------------------------------------------
would do the job (rename the aliases as you see fit.
Effectively any user in group XMODUSERS can, on all systems, execute the command pointed to by XCONFSCRIPT as root without suplying a password
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.