LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 03-02-2015, 12:22 PM   #1
TheHarmattan
LQ Newbie
 
Registered: Feb 2015
Posts: 10

Rep: Reputation: Disabled
File Permissions


I'm writing a simple installer and I'm stumped
on how to create user accounts.

How cant I create root account without first being root?


This installer is made only in C++.

Thanks for your help!
 
Old 03-02-2015, 02:12 PM   #2
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 999

Rep: Reputation: 142Reputation: 142
Quote:
How cant I create root account without first being root?
Impossible, hopefully - it would be a major security breach.
 
Old 03-02-2015, 02:19 PM   #3
TheHarmattan
LQ Newbie
 
Registered: Feb 2015
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Pearlseattle View Post
Impossible, hopefully - it would be a major security breach.
I know it's not possible.
My question is what can
I do to get a root password
from the user during the install
process?

Thanks for the quick reply.
 
Old 03-02-2015, 02:29 PM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Don't...

The usual solution is to start sudo with the command you want processed.

Sudo will then prompt for the appropriate password if the user is authorized...

If you are using a GUI there are a couple of GUI versions that accomplish the same thing.

The reason you don't is that there is NO reason for the user to trust your installer beyond what it should be doing. There is no reason for it to HAVE the root password, as you may have a trojan that passes the root password off to someone else...

Last edited by jpollard; 03-02-2015 at 02:32 PM.
 
Old 03-02-2015, 02:37 PM   #5
TheHarmattan
LQ Newbie
 
Registered: Feb 2015
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
Don't...

The usual solution is to start sudo with the command you want processed.

Sudo will then prompt for the appropriate password if the user is authorized...

If you are using a GUI there are a couple of GUI versions that accomplish the same thing.

The reason you don't is that there is NO reason for the user to trust your installer beyond what it should be doing. There is no reason for it to HAVE the root password, as you may have a trojan that passes the root password off to someone else...
There are no authorized users because
we are in the install process.
This "catch-22" is almost breaking
my will.
 
Old 03-02-2015, 02:47 PM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
If the admins are installing the system, they are the ones to set it up.

Not you. You DO get to tell them to configure it. But it is up to the site policy as to who gets to do what to the system. And passing the root password around is not a proper security policy.

Now if you are writing a system installer, then your installer is ALREADY root. But most of those are NOT written in C++. They are frequently done in Python, or shell scripts.
 
Old 03-02-2015, 03:15 PM   #7
TheHarmattan
LQ Newbie
 
Registered: Feb 2015
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
If the admins are installing the system, they are the ones to set it up.

Not you. You DO get to tell them to configure it. But it is up to the site policy as to who gets to do what to the system. And passing the root password around is not a proper security policy.

Now if you are writing a system installer, then your installer is ALREADY root. But most of those are NOT written in C++. They are frequently done in Python, or shell scripts.
Thank you. I am writing a system installer.
I'm thinking about the Anaconda installer.
During the install process
the installer asks for a user generated
password for the root account.

I would just like to take that input
and finish installing a custom distro.

I am most comfortable in C++. I'm aware
of the runtime support needed to get
things going.
Thanks for your help!

Last edited by TheHarmattan; 03-02-2015 at 03:18 PM.
 
Old 03-02-2015, 03:42 PM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
It is much more flexible to use one already written - such as Anaconda.

Installation tools are quite large, and have to handle a number of complex subjects. That was why Anaconda is written in Python.

And it is possible to do a custom distribution with Anaconda - it usually called a "spin", and there are tools available that make it realatively easy to do.

http://fedoraproject.org/wiki/How_to...fedora_desktop
 
Old 03-02-2015, 03:46 PM   #9
genss
Member
 
Registered: Nov 2013
Posts: 741

Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
It is much more flexible to use one already written - such as Anaconda.

Installation tools are quite large, and have to handle a number of complex subjects.
they are complex, but the subjects that they handle are simple

unpack all the packages
set up language, time, etc
what else ?

anaconda is very complex, not recommended playing around with
 
Old 03-02-2015, 03:59 PM   #10
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by genss View Post
they are complex, but the subjects that they handle are simple

unpack all the packages
set up language, time, etc
what else ?

anaconda is very complex, not recommended playing around with
keyboard setup,
display setup,
disk partitioning,
identifying the target to install on (partition/lvm/mdadm + partitioning)
identifying the source to retrieve the packages from (URL/net? disk? USB? NFS?) and setup,
package selection (assuming there IS a choice).
filesystem to use (xfs,ext4,btrfs,other?)
boot configuration and initialization,
mount configuration (fstab setup mostly),
swap configuration and initialization,

Of course, if all of this is supposed to be done, then you aren't doing an installation, but something closer to just cloning a disk...

In which case all you do is install the finished clone.

Anaconda is rather complex because it is trying to do something that IS complex.

Last edited by jpollard; 03-02-2015 at 04:02 PM.
 
Old 03-02-2015, 04:04 PM   #11
TheHarmattan
LQ Newbie
 
Registered: Feb 2015
Posts: 10

Original Poster
Rep: Reputation: Disabled
Thank you all for your response.

I am not interested in spinning
a distro with Anaconda. I have
written the installer already.
Minus the "root problem".

I just need some kind of way
to get around this "catch-22".

Once again, thanks!

(I might end up using Anaconda
but the question on how to solve
this problem will eat at me)
 
Old 03-02-2015, 04:08 PM   #12
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by TheHarmattan View Post
Thank you all for your response.

I am not interested in spinning
a distro with Anaconda. I have
written the installer already.
Minus the "root problem".

I just need some kind of way
to get around this "catch-22".

Once again, thanks!

(I might end up using Anaconda
but the question on how to solve
this problem will eat at me)
Then look at how Anaconda solves it.
 
Old 03-02-2015, 04:24 PM   #13
TheHarmattan
LQ Newbie
 
Registered: Feb 2015
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
Then look at how Anaconda solves it.
Right on!
I'm just thinking that the solution will
be Python specific but I'll
comb the source.

Thanks!

Last edited by TheHarmattan; 03-02-2015 at 04:25 PM.
 
Old 03-02-2015, 04:32 PM   #14
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
No. It can't be specific. The technique is not that complicated.

Another place to look would be in the passwd utility. It does the same thing.

Now one thing that MAY be a problem is that during the initial install, the terminals are NOT configured. You have to do that if you are using a terminal interface. If you are using a GUI, then Anaconda is quite reasonable to look at, as it uses the same GUI libraries that you would likely be using.
 
Old 03-02-2015, 04:42 PM   #15
TheHarmattan
LQ Newbie
 
Registered: Feb 2015
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
No. It can't be specific. The technique is not that complicated.

Another place to look would be in the passwd utility. It does the same thing.

Now one thing that MAY be a problem is that during the initial install, the terminals are NOT configured. You have to do that if you are using a terminal interface. If you are using a GUI, then Anaconda is quite reasonable to look at, as it uses the same GUI libraries that you would likely be using.
Thanks jpollard. You and everyone in this post
have been very accommodating.

Cheers, friend. I'll come back to
this post and report later this evening.

Once again, thanks!
 
  


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
File Permissions- Once again the Permissions questions?? fusionstate Linux - Newbie 2 01-04-2014 12:47 PM
chmod: changing permissions of `/usr../bin': Read-only file File System Issue cdhar Linux - Newbie 3 12-31-2012 06:17 AM
SMB - File copy from Windows file permissions changed? tiger.woods Red Hat 1 12-04-2012 06:18 AM
File permissions v. directory permissions Completely Clueless Linux - Newbie 7 07-09-2009 08:33 AM
file permissions OK, but command permissions? stabu Linux - General 2 10-05-2005 12:00 PM

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

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