LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-27-2008, 03:03 AM   #1
tuesday
Member
 
Registered: Mar 2008
Location: Malaysia
Distribution: RedHat Enterprise Linux 4
Posts: 42

Rep: Reputation: 15
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?
 
Old 03-27-2008, 09:21 AM   #2
mahmoud
Member
 
Registered: Apr 2006
Location: UK
Distribution: Mandriva, Debain, Redhat, Fedora, Ubuntu, FreeBSD
Posts: 269

Rep: Reputation: 30
you can use sudo or you can edit the etc/passwd file and add the user to the group
 
Old 03-27-2008, 11:18 PM   #3
chakka.lokesh
Member
 
Registered: Mar 2008
Distribution: Ubuntu
Posts: 270

Rep: Reputation: 33
Smile

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.
 
Old 03-31-2008, 12:02 AM   #4
tuesday
Member
 
Registered: Mar 2008
Location: Malaysia
Distribution: RedHat Enterprise Linux 4
Posts: 42

Original Poster
Rep: Reputation: 15
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.
 
Old 03-31-2008, 03:19 AM   #5
tuesday
Member
 
Registered: Mar 2008
Location: Malaysia
Distribution: RedHat Enterprise Linux 4
Posts: 42

Original Poster
Rep: Reputation: 15
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?
 
Old 04-01-2008, 01:23 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,344

Rep: Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746
Use sudo (as prev suggested)
now you know why messing with perms is not recommended....
 
Old 04-01-2008, 02:18 AM   #7
fraserc
LQ Newbie
 
Registered: Dec 2004
Location: Scotland
Distribution: SUSE 9.0 Professional
Posts: 6

Rep: Reputation: 0
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
 
Old 04-01-2008, 03:38 AM   #8
tuesday
Member
 
Registered: Mar 2008
Location: Malaysia
Distribution: RedHat Enterprise Linux 4
Posts: 42

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by chrism01 View Post
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.
 
Old 04-01-2008, 06:46 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,344

Rep: Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746
You set the install script to install a sudoers file with the nopasswd option set for your test user.
 
Old 04-02-2008, 12:42 AM   #10
tuesday
Member
 
Registered: Mar 2008
Location: Malaysia
Distribution: RedHat Enterprise Linux 4
Posts: 42

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by chrism01 View Post
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?
 
Old 04-02-2008, 12:51 AM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,344

Rep: Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746Reputation: 2746
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't su into root as normal user darin3200 Linux - General 13 03-18-2010 11:03 AM
Normal & Root User sobia Linux - Security 7 10-03-2005 02:18 AM
Root? normal user? what does it all mean? Zieroth Linux - Newbie 5 07-16-2004 04:06 PM
Games runs slow as normal user, but fast as root user mcore Linux - Software 2 06-07-2004 11:11 PM
Root and normal user Smooth Linux - Newbie 4 05-27-2003 10:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:57 AM.

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