LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-22-2014, 04:23 PM   #1
mechsteel
LQ Newbie
 
Registered: Aug 2006
Location: Prattville, Al
Distribution: Gentoo; Ubuntu; FC; RHEL
Posts: 4

Rep: Reputation: 0
How do i write to /etc/udev/rules.d/ from with in a makefile?


I am updating a makefile for a kernel module for a proprietary DIO card. Everything works well and I can talk to my device fine as root. I can create a udev rule to give group privileges and again works great as long as I am a member of said group.

I would like to have the makefile create the udev rule when "make install" is run by a normal user. How do I do this? Right now I have it generating the udev rule by "sudo echo "rule" >> /tmp/test.rule" and then "sudo cp test.rule >> /etc/udev/rules.d/". This asks for the root password, but does create the rule.(It would not let me create the file directly to /udev/rules.d/...permission denied even when the root password was given.

Sorry to be long winded, just wanted to give as much info as possible.
 
Old 07-23-2014, 12:30 PM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,871
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
What you cannot do without make you cannot do with make either.
 
Old 07-23-2014, 03:14 PM   #3
PenGUiN_6_1
Member
 
Registered: Oct 2006
Location: Brunswick, MD
Distribution: gNewSense 2.3 (deltah) i386
Posts: 57

Rep: Reputation: 22
Maybe use the make command to compile, but to be safe, run "sudo make all' IF 'all:' is a target in the file; otherwise run 'sudo make install'

Run a ./configure that allows you to interactively set up the temp rulefile. Use 'sudo make install' to actually put that into the udev ruleset. Best advice:

Use a combo of awk, grep, sed (the gmakefiles use these; I think the kernel makefiles do as well, as to other makefiles)

Last edited by PenGUiN_6_1; 07-23-2014 at 03:23 PM.
 
Old 07-25-2014, 10:29 AM   #4
mechsteel
LQ Newbie
 
Registered: Aug 2006
Location: Prattville, Al
Distribution: Gentoo; Ubuntu; FC; RHEL
Posts: 4

Original Poster
Rep: Reputation: 0
@PenGUiN_6_1, I want the normal user to able to run make with out having to enter the root password. Is there an equivalent to something along the lines of SETUID that can be used in a makefile?
 
Old 07-25-2014, 10:41 AM   #5
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,871
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
(I'll write it very slowly this time, to make it easier to understand):
What you cannot do without make you cannot do with make either.

Should you have doubts, check if file /usr/bin/make has the setuid bit

Last edited by NevemTeve; 07-25-2014 at 10:43 AM.
 
Old 07-25-2014, 01:36 PM   #6
mechsteel
LQ Newbie
 
Registered: Aug 2006
Location: Prattville, Al
Distribution: Gentoo; Ubuntu; FC; RHEL
Posts: 4

Original Poster
Rep: Reputation: 0
@NevemTeve@PenGUiN_6_1 - Thanks for the help. I'll close this thread.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
RKHunter ASCII text in /dev/.udev/rules.d/root.rules metrx Linux - Security 2 03-07-2014 08:37 AM
How to write udev rules for USB hard disk drives mscole Slackware 14 11-04-2010 05:46 PM
help with udev rules and write permisions teodor_b Linux - Software 2 08-17-2009 03:00 AM
cat: /etc/udev/rules.d/70-persistent-net.rules: No such file or directory rcg1984 Linux From Scratch 2 09-17-2008 07:02 AM
slackware-current, udev 0.96, and custom udev rules not working rignes Slackware 6 08-10-2006 03:43 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration