LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Installing a package into a user other than root (https://www.linuxquestions.org/questions/linux-newbie-8/installing-a-package-into-a-user-other-than-root-4175502690/)

battles 04-23-2014 08:10 AM

Installing a package into a user other than root
 
I am having difficulty understanding how to install a package into a user other than root. I log into a user I have created as adduser webserver. When i go to install, I get:

E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Do I need to do a 'sudo apt-get install boa'?
Does that install boa in root rather than user webserver?

Also can't figure what using just su does.
Thanks.

eudald 04-23-2014 08:15 AM

Hi battles,

Software installation must be done under root privileges for security reasons.

There're a few ways to do it, being the most common:
Code:

sudo apt-get install boa
The software will be available to all users, but some features will only be accessible through root account, depending on the software.

Regards,
Eudald

jamison20000e 04-23-2014 08:18 AM

Hi. I'm no guru on this but most software gets added as root then you (may need to) add users or groups privileges to use it... hope that helps best wishes and have fun. :)

battles 04-23-2014 08:21 AM

Software installation must be done under root privileges
 
Thanks. I suppose that it installs it into the user wherein you type 'apt-get install boa'.

The reason I was somewhat confused is because I created a key with a program using sudo before the program's name within the program's user, but the program put the key into the root folder. I was told to leave out sudo to get the program to put the key in the user's folder instead.

battles 04-23-2014 08:26 AM

Told this was a no no
 
Quote:

Originally Posted by jamison20000e (Post 5157675)
Hi. I'm no guru on this but most software gets added as root then you (may need to) add users or groups privileges to use it... hope that helps best wishes and have fun. :)

Appreciate you post. From what I have been told, you should never install anything into root, but always put installed programs into a user account. I am so new to linux, what do I know?

jamison20000e 04-23-2014 08:43 AM

You do have to be as careful with sudo it's just temporary root for the most part.

battles 04-23-2014 08:49 AM

Key creation problem
 
I think my Key creation problem was kind of unique. I was just using sudo on everything I was doing.

jamison20000e 04-23-2014 08:50 AM

Slightly off topic, have you done:I see the 7.1 and I'm at 7.4?

battles 04-23-2014 08:55 AM

Interesting. My server is providing Debian 7.1. Being somewhat new to Linux, I don't want to do that, lest I blow myself up somehow :). Will keep the string in my notes.

jamison20000e 04-23-2014 09:05 AM

If you don't do updates or automate at least security ones you won't have them...

jamison20000e 04-23-2014 09:08 AM

Same thing with personal and config data backups. ;)

Shadow_7 04-23-2014 09:38 AM

Programs get added AS root, they should not go into /root/ which is the /home/ for root. They typically go to /usr/bin/ or /usr/local/bin/ depending on the system. For the execute-able anyway. You should never RUN programs as root (if you can avoid it), and prefixing things with sudo does things with root permissions. But not all programs adhere to best practices. And many daily admin stuffs (updates) gets us into bad habits.

In general you cannot install programs as a user. At least not with the package management system. Not entirely true, you can apt-get source <package> and compile the app and run it from the /home/ of the user as the user. And maybe some cryptic way to get the deb and extract the contents to the /home/ of the user as the user. But that's not typically done, except for developer types.


All times are GMT -5. The time now is 12:46 AM.