LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-06-2019, 06:53 AM   #1
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Ubuntu, Debian, Slackware
Posts: 2,178
Blog Entries: 6

Rep: Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470
Compiling as root [Slackbuilds]


Reading around, it seems it's inadvisable to compile packages as root. However, this is something I've always done since I thought one needed to be root for the .txz to be dropped into /tmp. All my packages were therefore compiled as root.

Is this an issue? All my computers are single-user systems and I never have to make changes to any of the packages.

EDIT: I should clarify, when I say 'compiling packages', I mean Slackbuilds.

Last edited by Lysander666; 01-06-2019 at 07:17 AM.
 
Old 01-06-2019, 07:01 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
it is dangerous. You download something and run something as root and you will never recognize if your system was damaged. Additionally some tools may not work properly if started by root.
 
Old 01-06-2019, 07:04 AM   #3
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Ubuntu, Debian, Slackware
Posts: 2,178

Original Poster
Blog Entries: 6

Rep: Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470
Quote:
Originally Posted by pan64 View Post
it is dangerous. You download something and run something as root and you will never recognize if your system was damaged. Additionally some tools may not work properly if started by root.
So if something is compiled as root it automatically runs as root?
 
Old 01-06-2019, 07:09 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
no, the building itself executed as root and may contain anything...
 
Old 01-06-2019, 07:16 AM   #5
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Ubuntu, Debian, Slackware
Posts: 2,178

Original Poster
Blog Entries: 6

Rep: Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470
Understood. What about sbopkg? Does not sbopkg compile as root [since it has to be run as root to work]?
 
Old 01-06-2019, 07:16 AM   #6
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
It's more that the makefile/build is run as root, so any commands in the makefile, or the ./configure script etc. will be run as root and have no restrictions on what they can do. There's plenty of scope for either damage due to error (more likely) or maliciousness (less likely).

I build a lot of my own slackbuilds as non-root. I use a wrapper script around makepkg that does all the stuff that requires superuser, everything else is run by a non-privileged user. Some makefiles may need further modification to support this though, so it's not always straight forward.

Other approaches include using 'fakeroot' (which uses some LD_PRELOAD shenanigans that I'm not personally a fan of).

The common approach in slackware circles is to just run builds as 'root'. I guess the rationale is that the SBo guys have already determined that there will be no harm from running their slackbuilds.
 
2 members found this post helpful.
Old 01-06-2019, 07:21 AM   #7
igadoter
Senior Member
 
Registered: Sep 2006
Location: wroclaw, poland
Distribution: many, primary Slackware
Posts: 2,717
Blog Entries: 1

Rep: Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625
You can build all slackbuilds packages as non-root - but then it requires little more job to create package - due to files permission. Also people here build with fake-root. The only point one requires root privileges is to build Slackware package. But subject was discussed many times. With the same conclusion: it does not matter.
 
1 members found this post helpful.
Old 01-06-2019, 07:32 AM   #8
EdGr
Member
 
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 998

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
I compile packages with my normal user account and install them in ~/.local

This precludes any possible damage to the system. The packages work for one user (me).

I have my .bash_login point to ~/.local

Code:
export PATH=/home/ed/.local/bin:$PATH
export LD_LIBRARY_PATH=/home/ed/.local/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=/home/ed/.local/pkgconfig:$PKG_CONFIG_PATH
export MANPATH=/home/ed/.local/man:$MANPATH
Ed
 
4 members found this post helpful.
Old 01-06-2019, 07:38 AM   #9
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
http://slackbuilds.org/faq/#root

See #11.
 
5 members found this post helpful.
Old 01-06-2019, 07:41 AM   #10
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Ubuntu, Debian, Slackware
Posts: 2,178

Original Poster
Blog Entries: 6

Rep: Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470Reputation: 2470
Quote:
Originally Posted by montagdude View Post
Thanks, good to know. I'll consider this solved.
 
Old 01-06-2019, 07:54 AM   #11
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
It all depends if you trust the people who wrote and checked the build script. I don't trust myself, so I run the ones I have written or edited as didier using fakeroot. There are a very few cases where it's not technically possible or easy, then I try to be more careful and run them as root.
 
Old 01-06-2019, 09:04 AM   #12
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,950

Rep: Reputation: Disabled
You can also use sandbox to compile as root and it should block most potentially malicious things from happening with a verbose warning or error.
 
Old 01-06-2019, 09:20 AM   #13
average_user
Member
 
Registered: Dec 2010
Location: Warsaw, Poland
Distribution: Slackware
Posts: 560

Rep: Reputation: 220Reputation: 220Reputation: 220
You can also consider using git://urchlay.naptime.net/sbostuff.git. This repository contains several helper scripts for working with slacbkuilds. For example, the following command will download source tarball as specified in .info file, validate its md5sum and run slackbuild script:
Code:
sbodl && sbrun
If slackbuilds script performs some fishy activities you receive the warning. Say I add this line to slackbuild script:
Code:
touch ~/PIRATE-FILE
I get this warning from sbrun:
Code:
sbrun: WARNING: files altered outside the sandbox:
c /root/PIRATE-FILE
It also blocks access to the network, for example 'wget linuxquestions.org' results in:
Code:
--2019-01-06 16:13:00--  http://linuxquestions.org/
Resolving linuxquestions.org... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘linuxquestions.org’
./global.SlackBuild exit status: 4
 
1 members found this post helpful.
  


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
how can i write to a root:root 750 file with a non-root user? Droa Linux - Newbie 1 05-14-2012 07:49 PM
Various Compiling Errors (GCC compiling Openal, GUIlib, xmms-wma) gregorya Linux - Software 2 08-27-2004 05:03 AM
Compiling in ACPI support on Compaq 2135CA (system crashes while compiling) Dag Linux - Laptop and Netbook 20 07-30-2004 07:56 PM
root files: create as root:root or root:wheel? pcass Linux - Security 1 02-07-2004 04:14 PM
Kernel compiling and module compiling tarballed Linux - General 1 12-22-2002 05:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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