LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 06-28-2011, 09:50 AM   #1
entz
Member
 
Registered: Mar 2007
Location: Milky Way , Planet Earth!
Distribution: Opensuse
Posts: 453
Blog Entries: 3

Rep: Reputation: 40
compiling the kernel as root ?


hi,

well according to "linux in a nutshell" the developer/user should never configure and compile the kernel source under root , however when i try to compile the latest version i get permission errors forcing me to use root...

so what to do ? ignore the warning from that book or what ?

cheers
 
Old 06-28-2011, 10:36 AM   #2
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Hi,

The usual path I always take to kernel (or other software) compilation is (simply):

- download the kernel/software as regular user
- unpack un the regular folder
- make configure
- make
- as root make install

Safe from the install, it is unwise to compile as Root. Not just a kernel but any software. Some reasons are that Root's folder is in an other partition altogether (mine is anyway) and an other reason is that any "intrusive" code can be detected without tampering with the system as a whole.

Some possible ideas rise here. Either you have done some extensive stuff as Root (installations and useage of) and have in effect two sets of working permissions. Try to find out what the system asks from you. Is it access to a shared section Root only has rights to? Does the regular user even have the needed permissions? Should'nt you re-install some stuff with the proper rights?

I'll be watching this (interesting) thread to see where it ends up...


Wellness

Thor
 
Old 06-28-2011, 10:46 AM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by entz View Post
hi,

well according to "linux in a nutshell" the developer/user should never configure and compile the kernel source under root , however when i try to compile the latest version i get permission errors forcing me to use root...

so what to do ? ignore the warning from that book or what ?

cheers
You don't need such kind of privileges to compile the kernel. So, my guess is that you download the kernel as root, or uncompressed it as root, or installed it using your package manager. In any of these cases, the kernel sources will probably be owned by root, and stored into a location where regular users can't write.

So, my advice is to just download it as a regular user, into your home directory, ucompress it as a regular user, and compile it as a regular user. Then just do this to install it:

Code:
su -c 'make install modules_install'
And give the root password when asked.

Otherwise, just use whatever method your distro says you should be using to compile your kernel as root. But I personally see no reason to operate as root for such kind of task. The less you use root, the more limited that the scope of any possible damage will be if you commit an error.
 
Old 06-28-2011, 11:14 AM   #4
entz
Member
 
Registered: Mar 2007
Location: Milky Way , Planet Earth!
Distribution: Opensuse
Posts: 453

Original Poster
Blog Entries: 3

Rep: Reputation: 40
Quote:
Originally Posted by Thor_2.0 View Post
Hi, Either you have done some extensive stuff as Root (installations and usage of) and have in effect two sets of working permissions
well yes i use root most of the time ...if not always.
what do you mean by 2 sets of working permissions ?

please explain ..

Quote:
So, my guess is that you download the kernel as root, or uncompressed it as root, or installed it using your package manager. In any of these cases, the kernel sources will probably be owned by root, and stored into a location where regular users can't write.
well not quite right , actually i've downloaded the source as root however i've quickly changed the owner and group ids to a normal user then i've placed it into a new directory owned by the same user and then SUed into that user and untarred the source and attempted to run "make config".

btw , i've discovered what went wrong an that is , the new directory which contained the tarball as well as the source itself (although they both had normal user ownerships) they were still under the root working directory for convenience (i.e /root/Desktop/normal-user-dir/linux.2.6.xx) so i moved the folder altogether into the home directory of the normal user and now it works .... oh stupid me

Last edited by entz; 06-28-2011 at 11:17 AM.
 
Old 06-28-2011, 11:30 AM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by entz View Post
well yes i use root most of the time ...if not always.
what do you mean by 2 sets of working permissions ?
Well, I won't try to evangelize here. They're well known, the reasons why you shouldn't do that. There's enough of that in the net in case no one already told you that yet.

http://www.google.es/#sclient=psy&hl...w=1680&bih=852

Quote:
well not quite right , actually i've downloaded the source as root however i've quickly changed the owner and group ids to a normal user then i've placed it into a new directory owned by the same user and then SUed into that user and untarred the source and attempted to run "make config".

btw , i've discovered what went wrong an that is , the new directory which contained the tarball as well as the source itself (although they both had normal user ownerships) they were still under the root working directory for convenience (i.e /root/Desktop/normal-user-dir/linux.2.6.xx) so i moved the folder altogether into the home directory of the normal user and now it works .... oh stupid me
Well, I was just guessing, since I hadn't much info to play with. Anyway, it scapes the limits of my comprehension why would anyone put a directory owned by a regular user under /root. There's a reason why the root home directory is not even under /home/, like the rest of home directories. To access a given path you need permissions to access all the upper levels, which implies compromising the privacy of the root user by granting at least +x for all the users into /root/.
 
Old 06-28-2011, 01:02 PM   #6
entz
Member
 
Registered: Mar 2007
Location: Milky Way , Planet Earth!
Distribution: Opensuse
Posts: 453

Original Poster
Blog Entries: 3

Rep: Reputation: 40
Quote:
Originally Posted by i92guboj View Post
Well, I won't try to evangelize here. They're well known, the reasons why you shouldn't do that. There's enough of that in the net in case no one already told you that yet.

http://www.google.es/#sclient=psy&hl...w=1680&bih=852



Well, I was just guessing, since I hadn't much info to play with. Anyway, it scapes the limits of my comprehension why would anyone put a directory owned by a regular user under /root. There's a reason why the root home directory is not even under /home/, like the rest of home directories. To access a given path you need permissions to access all the upper levels, which implies compromising the privacy of the root user by granting at least +x for all the users into /root/.
well it's not that "no one" has told me about not running as root , it's that i don't really care ...besides running as a normal user on a desktop system is a PITA.

anyways that's beyond this discussion ...

as for your inability to comprehend why i did place that dir (owned by regular users) under /root , well i'd already said it's for convenience , btw the root directory was never compromised at any point in time , did I it mention that i'm the ONLY user on my system?

cheers
 
Old 06-28-2011, 05:20 PM   #7
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
It doesn't mind you are the only user on your system. That's the case as well in most Windows based PC's, and we all know what happens to them. Any threat will have as much privileges as the active user it runs under. If you run Firefox as root any stupid porn site can blow up your system. But, as you very well said, that's out of the discussion. Sorry for being off-topic, but when I suggest someone to do something in a support forum I want to know that s/he knows at least the implication of the wrong things s/he's doing. I think it's a legitimate course of action.
 
Old 06-28-2011, 06:37 PM   #8
entz
Member
 
Registered: Mar 2007
Location: Milky Way , Planet Earth!
Distribution: Opensuse
Posts: 453

Original Poster
Blog Entries: 3

Rep: Reputation: 40
Quote:
Originally Posted by i92guboj View Post
If you run Firefox as root any stupid porn site can blow up your system.
well yes theoretically that's true but strangely enough in the last 4 years since i've started using linux that never actually happened , not that i don't visit stupid porn sites though

anyways , i guess you brought me to a new idea regarding security (not that it's needed but just as an extra check) namely modify the Desktop launcher for firefox to something like
Code:
su user -c "firefox %f"
.

to be honest , i've thinking about a way to find a new compromise between convenience and security , that's definitely an approach worth researching in the distro that i'm building ..

cheers
 
  


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
Good but sorta easy guide to Kernel compiling/Re-Compiling? linus72 Linux - General 1 07-13-2009 01:37 PM
Compiling a module separately without compiling entire kernel kushalkoolwal Linux - Kernel 8 08-06-2008 01:45 AM
compiling kernel problem --- Kernel panic: unable to mount root fs ........ anthonymts123 Linux - General 5 07-31-2006 02:29 AM
After compiling Kernel 2.6.7 when I boot the image it sez it cannot mount root fs gibiman Linux - Software 2 08-07-2004 06:23 AM
Kernel compiling and module compiling tarballed Linux - General 1 12-22-2002 05:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 09:11 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