LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Not understanding package installing (https://www.linuxquestions.org/questions/linux-newbie-8/not-understanding-package-installing-4175502893/)

battles 04-24-2014 06:14 PM

Not understanding package installing
 
I was told on another site that you should never install programs in root. I was then told to install postfix from root, that postfix would take care of itself. I also installed the mixmaster packaged program into an 'adduser mix' user and was told that I should have just done the 'apt-get install mixmaster' from root. Do some or all packages set up their own adduser <name>?

What am I not understanding here? Thanks.

frankbell 04-24-2014 07:41 PM

There are three "roots" in Linux.

"root" is the administrative user, comparable to "administrator" in Windows.

/ is the "root" directory; if you visualize the file system as a tree, / is the "root" of the tree.

/root is a directory under / and is the home directory for the root user.

This article should help you understand the Linux file system.

Normally, you would not install a program in the root diectory or in the root of the file system, but you would install a program as root, that is, with administrative rights, because the root user has the rights to place all the program's files where they belong.

Hope this helps.

battles 04-24-2014 07:59 PM

Quote:

Originally Posted by frankbell (Post 5158723)
There are three "roots" in Linux.

"root" is the administrative user, comparable to "administrator" in Windows.

/ is the "root" directory; if you visualize the file system as a tree, / is the "root" of the tree.

/root is a directory under / and is the home directory for the root user.

The three root explanation and reference page seems to explain it to me. So the advise to not install anything in root is referring to the root directory. Doing an "apt-get install mixmaster" then is not going to install it in the /root directory. I thought that if my screen was showing 'root@me:~#', that doing an 'apt-get install <pgm>' at that prompt was going to install <pgm> in directory /root.

There is actually no reason to set up any adduser accounts on a single user machine. Am I clear on this?

frankbell 04-24-2014 09:21 PM

Quote:

Doing an "apt-get install mixmaster" then is not going to install it in the /root directory
Correct. That command would install everything to where it is supposed to be, using the authority of the root user.

It would be wise to set up a user account that has regular user permissions and does not have root privileges. This article will tell you more about permissions on Linux. I'm not suggesting that you learn it, just that you get the general idea.

You can then log in as user to do day-to-day stuff with user privileges, which adds a layer of protection, then log in as root or use the su command to do root (that is, configuration) stuff. User might, for example, click on a malicious link which introduces some malware, but the malware will not have the ability to break out into the rest of the computer.

Almost no experienced Linux users would suggest that you do day-to-day computing as the root user.

Some Linux distros (Ubuntu and many of its derivatives, for example) actually mask the root account (though it's easy to unmask it) and suggest that persons use the sudo command to do root stuff; personally, I think Ubuntu's sudo fetish is just silly, but that's just my two cents.

Linux is not hard, but it is different. There is a learning curve. I came to Linux from Windows, just because I had heard about this Linux thing and was curious; now I use Windows only when I must. After nine years, I've reached the conclusion that, ultimately, Linux is much more logical than that other operating system.

About dot com has a very good section about Linux. You might want to check it out.

ndc85430 04-24-2014 11:48 PM

Quote:

Originally Posted by battles (Post 5158729)
There is actually no reason to set up any adduser accounts on a single user machine. Am I clear on this?

"adduser" is a command to add users to the system. They are just "user accounts", not "adduser accounts". You should always have a non-root user account for daily use and only use the root account when required (for, e.g. installing software as detailed above). One reason is that if you're not careful, you can screw up your system. By having a user account, you avoid this problem as you don't have permissions to modify system files. Of course, you do need to be careful when using the root account, but by minimising its use, you minimise the possibility of accidents.

Shadow_7 04-25-2014 12:00 AM

root vs. users is a permissions thing. Root has permissions to do "ANYTHING" to your filesystem and computer. A user has "LIMITED" permissions. You basically need root to install most applications. But you should never RUN "most" applications as root.

From a developers perspective you can do basically everything from downloading, extracting, and compiling an application as a user. Up until the point of "make install" which accesses parts of an installation ONLY available to root (or with root permissions aka sudo). You can still run applications compiled by a user without make install. But only that user has the ability since the executable result of the compile has that users permissions. Not quite that simple since you may need to do some $PATH environment stuff to run an application and it's parts, but possible.

battles 04-25-2014 06:03 AM

Really good and comprehensible explanations here. Thank very much.

One other question. If I create a user for non-root daily programs to run from, do I login into that user and install programs using: 'sudo apt-get install <program>'? Do I need to set up root privileges for the user account with visudo to install a program while in that user acount? Or should I ever be installing anything from the user account?

frankbell 04-25-2014 08:11 PM

Quote:

One other question. If I create a user for non-root daily programs to run from, do I login into that user and install programs using: 'sudo apt-get install <program>'?
If the distro you are using has sudo configured, yes. If it does not, you will get an error message. Some distros enable sudo out of the box (famously, Ubuntu and its derivatives). Others do not (Slackware, for example; as for Debian, I've had it installed on this machine so long I can't remember, but, at the time of Debian 5.0, I don't think it did), but those distros tend to allow the su command by default.

If you use sudo, your login will retain root privileges for a set amount of time, often five minutes, during which you will not need to reenter your password. If you use su, you actually become logged in as the other user and must type exit to end the su session.

This article gives a pretty good explanation of the differences; I'm going to point you to it, rather than try to duplicate it myself.

Shadow_7 04-25-2014 11:39 PM

If you add an additional user, it may not be added to the adm and sudo groups by default. Which is needed to have permissions to use sudo effectively in distros like ubuntu or based off of ubuntu.


All times are GMT -5. The time now is 04:43 PM.