LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Installing programs for normal user (non-root) (https://www.linuxquestions.org/questions/linux-general-1/installing-programs-for-normal-user-non-root-630951/)

tuesday 03-27-2008 03:03 AM

Installing programs for normal user (non-root)
 
Hi guys!

I'm building a script that will automatically install and run an application after the system if booted up.

The problem is, I need to be a root to do install the application. So, the questions are:

1. Is there anyway to allow normal user to install program in Linux? or is there anyway to log in as root using script?

2. I manage to create a new user but fail to change its password. What is the default password when we create a new user or how to change the user password using script?

mahmoud 03-27-2008 09:21 AM

you can use sudo or you can edit the etc/passwd file and add the user to the group

chakka.lokesh 03-27-2008 11:18 PM

hi

I am new to this linux platform. I think the following will work.

in the etc/passwd you change your id as 0 (as in the line of root) and try.

tuesday 03-31-2008 12:02 AM

Hi guys!

mahmoud
I tried to add the user into the root group which is 'wheel' if I'm not mistaken, but it still doesn't work.

chakka.lokesh
Hey, I tried your method and it gives an error. Maybe since the user is already registered for an ID, we can't really change the thing manually.

But then, I found the most suitable solution for now; which is by giving ownership of certain folders (/sbin & /lib & /usr & /etc) to the user that want to do the installation job.

I know, some people would say it is not recommended to do this, but in my case, it would be okay since both users are controlled by me.

Thanks everyone for your idea.

tuesday 03-31-2008 03:19 AM

Okay,

I might have said/typed something misguiding before.

DON'T CHANGE THE OWNERSHIP OF YOUR TOP DIRECTORY FOLDER (/bin, /sbin, /etc, or /lib). It will return you an error when you want to shutdown. Geez, now I have to tackle another problem...

Anyway, does anybody have any brilliant idea regarding this topic again?

chrism01 04-01-2008 01:23 AM

Use sudo (as prev suggested)
now you know why messing with perms is not recommended....

fraserc 04-01-2008 02:18 AM

It might help if we knew more about just what you're trying to do. Why do you want to install this program every time you boot? (Surely it'll still be there the next time?

Does it have to be installed globally, or can it be installed in a specific user's home directory?

Which distro are you using?

Cheers

tuesday 04-01-2008 03:38 AM

Quote:

Originally Posted by chrism01 (Post 3106762)
now you know why messing with perms is not recommended....

Yeah, thanks for the warning... I'm trying something big here, so reinstalling the OS is a price I'm willing to pay.

Let see, I'm going to make an image of RHEL that will automatically install OS and run some test without prompting anything from user. Yep, that will include autologin, installing the test application and running it. I'm using kickstart to automate the OS installation and now stuck at installing the application. I manage to do the autologin only for normal user, not for root and that's way I'm asking here.

using 'sudo' or 'su root' should be okay, but the problem is it will prompt for password and I can't automate it using script. So any other idea?

fraserc
My distro is as stated in my profile box - RedHat Enterprise Linux 4. Can we actually install something into a user Home directory? I'm using '.tar.gz' kind of installer not the '.rpm' kind of thing.

chrism01 04-01-2008 06:46 PM

You set the install script to install a sudoers file with the nopasswd option set for your test user.

tuesday 04-02-2008 12:42 AM

Quote:

Originally Posted by chrism01 (Post 3107706)
You set the install script to install a sudoers file with the nopasswd option set for your test user.

Can you explain a little bit more?

chrism01 04-02-2008 12:51 AM

See this page:
http://www.sudo.ws/sudo/man/sudoers.html

NOPASSWD and PASSWD

By default, sudo requires that a user authenticate him or herself before running a command. This behavior can be modified via the NOPASSWD tag. Like a Runas_Spec, the NOPASSWD tag sets a default for the commands that follow it in the Cmnd_Spec_List. Conversely, the PASSWD tag can be used to reverse things. For example:

ray rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm

would allow the user ray to run /bin/kill, /bin/ls, and /usr/bin/lprm as root on the machine rushmore as root without authenticating himself. If we only want ray to be able to run /bin/kill without a password the entry would be:

ray rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm

Note, however, that the PASSWD tag has no effect on users who are in the group specified by the exempt_group option.

By default, if the NOPASSWD tag is applied to any of the entries for a user on the current host, he or she will be able to run sudo -l without a password. Additionally, a user may only run sudo -v without a password if the NOPASSWD tag is present for all a user's entries that pertain to the current host. This behavior may be overridden via the verifypw and listpw options.


All times are GMT -5. The time now is 06:35 AM.