Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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?
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?
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.