Linux - KernelThis forum is for all discussion relating to the Linux kernel.
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.
but this solution requires to set sticky bit chown root:root; chmod u+s.
The question is how to get root privileges only by providing user name and password (by process and to this process, - so process asking user for login information and use this permission to execution).
Solution shall work on all of the modern Linux environments since RHEL 4.
This is not sticky bit. But this is changing owner/group to root:root and then applying SUID. Sticky bit can be set as:-
Code:
~$ chmod a+t filename
But once let's know what is your purpose of doing this, and where you want to apply these changes?
I am working on GUI program that should ask user for in which mode this program should be executed, under non-root account (under is user account) or under privileged account (under root). So, I just have a dialog with that options, and if users clicked to continue execution under root account, program asks user for login information.
I know some tricks with IOCTL, but I think it's not good idea to going around su command. In addition, this program should be transferred without installation and I can't ask user to set file system permissions before launch.
It's easier to just set the command-prompt to "#" from "$".
Believe me, kid, if it really were this easy, legions of bored MIT students would have done it long before you were born.
Thank you for your opinion, but if there is no easiest ways are exists, can you suggest a hard one? This feature is really necessary for my app, and I have to find a solution.
I know some tricks with IOCTL, but I think it's not good idea to going around su command. In addition, this program should be transferred without installation and I can't ask user to set file system permissions before launch.
Once share the screenshot of the error dialogue box. And let's know what is your application.
However, if you've to set sticky bit, you can use above said method. It's actually used to run an executable with file owner's privileges and in your case it's root. So when you will invoke the excutable file (i.e. your application), you will automatically invoke it with root privilages.
On RHEL there is a preferred method for doing that which involves using consolehelper. I suggest you use that instead of re-inventing the wheel yourself or introducing setuid root binaries completely unnecessarily.
Once share the screenshot of the error dialogue box. And let's know what is your application.
However, if you've to set sticky bit, you can use above said method. It's actually used to run an executable with file owner's privileges and in your case it's root. So when you will invoke the excutable file (i.e. your application), you will automatically invoke it with root privilages.
So once also share output of following:-
Code:
~$ ls -la <filename>
I am workin on application installer that should ask user in which privileges installer should install an apps, for current user, or for all users. So, I can ask user about setting file system permission.
Error box? I don't have any error messages, and ls will show you usual permissions.
On RHEL there is a preferred method for doing that which involves using consolehelper. I suggest you use that instead of re-inventing the wheel yourself or introducing setuid root binaries completely unnecessarily.
Thank you unSpawn, unfortunately for this solution, app should work on any modern Linux distributions, not only RHEL.
I am working on GUI program that should ask user for in which mode this program should be executed, under non-root account (under is user account) or under privileged account (under root). So, I just have a dialog with that options, and if users clicked to continue execution under root account, program asks user for login information.
You want to use kdesudo, gksu or something similar.
AFAIK Gnomesu, gksudo, gksu, kdesu, kdesudo are tied to the installed choice of Desktop Environments. consolehelper OTOH is tied to PAM so most current, maintained distro releases should have it.
AFAIK Gnomesu, gksudo, gksu, kdesu, kdesudo are tied to the installed choice of Desktop Environments. consolehelper OTOH is tied to PAM so most current, maintained distro releases should have it.
Sure, but am I looking for how to do this by system calls. And from your suggestion, PAM is available since RHEL 5, for me RHEL 4 support is also required.
You want to use kdesudo, gksu or something similar.
I agree, this solution will work on most of the system now, but what happened one day, when new desktop environment will be released and user will try to this this app? No *su* will be found, and application functionality will be missed. It's not a right way to solve this puzzle. It's also affects user who will try to start an app in very unusual DE.
Previous millennium. Old school. PAM was already incorporated way back when Fedora's predecessor still went by the name of "Red Hat Linux".
Ok, only one way to use PAM what I found (http://vkrejcirik.info/2012/06/09/au...-pam-in-linux/) is to change group permissions. But, I need a way where I do not need to change anything on a user machine, just ask for user name and password and do my job.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.