LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   File Permissions (https://www.linuxquestions.org/questions/programming-9/file-permissions-4175535547/)

TheHarmattan 03-02-2015 12:22 PM

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!

Pearlseattle 03-02-2015 02:12 PM

Quote:

How cant I create root account without first being root?
Impossible, hopefully - it would be a major security breach.

TheHarmattan 03-02-2015 02:19 PM

Quote:

Originally Posted by Pearlseattle (Post 5325809)
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.

jpollard 03-02-2015 02:29 PM

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...

TheHarmattan 03-02-2015 02:37 PM

Quote:

Originally Posted by jpollard (Post 5325825)
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.

jpollard 03-02-2015 02:47 PM

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.

TheHarmattan 03-02-2015 03:15 PM

Quote:

Originally Posted by jpollard (Post 5325835)
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!

jpollard 03-02-2015 03:42 PM

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

genss 03-02-2015 03:46 PM

Quote:

Originally Posted by jpollard (Post 5325867)
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

jpollard 03-02-2015 03:59 PM

Quote:

Originally Posted by genss (Post 5325871)
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.

TheHarmattan 03-02-2015 04:04 PM

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)

jpollard 03-02-2015 04:08 PM

Quote:

Originally Posted by TheHarmattan (Post 5325878)
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.

TheHarmattan 03-02-2015 04:24 PM

Quote:

Originally Posted by jpollard (Post 5325882)
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!

jpollard 03-02-2015 04:32 PM

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.

TheHarmattan 03-02-2015 04:42 PM

Quote:

Originally Posted by jpollard (Post 5325895)
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!


All times are GMT -5. The time now is 03:09 PM.