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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
|
01-30-2002, 08:21 PM
|
#1
|
Member
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510
Rep:
|
Launch program as root, without su'ing
Without su'ing to root, how can I launch a program as root, when I'm logged on as a normal user?
I added a program to my KBar, but the program needs to be run with root priveledges.
The program is LinNeighborhood. I can't mount an NT share if I launch the program as a normal user.
|
|
|
01-30-2002, 08:23 PM
|
#2
|
LQ Guru
Registered: Jan 2001
Posts: 24,149
|
change the permissions of the file or ownership.
man chmod ( change permissions )
man chown ( ownership )
-trickykid
|
|
|
01-30-2002, 08:47 PM
|
#3
|
Member
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510
Original Poster
Rep:
|
I don't understand what that has to do with it. The program file already has chmod 777 and is owned by root.
|
|
|
01-30-2002, 09:09 PM
|
#4
|
LQ Addict
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704
Rep:
|
chown the proggy for the user
as root
chown userid:usergroup
|
|
|
01-30-2002, 10:08 PM
|
#5
|
LQ Guru
Registered: Jan 2001
Posts: 24,149
|
or look into sudo...
|
|
|
01-31-2002, 03:55 AM
|
#6
|
Member
Registered: Sep 2001
Distribution: Gentoo
Posts: 760
Rep:
|
Don't suid LinNeightborhood. suid smbmount and smbumount
|
|
|
01-31-2002, 03:31 PM
|
#7
|
Member
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510
Original Poster
Rep:
|
Ack. Either I don't understand what you guys or talking about, or you guys don't understand what I'm getting at.
Here it is. I log on to KDE as my normal user account. There is a program called LinNeighborhood. I need to run this program as root. I don't want to open the Konsole, su to root, and run the program. That's too tedious. Instead, I have a shortcut to the program placed in my KBar. But when I click on the shortcut, it runs the program under my normal user. How do I make it so that when I click on the shortcut in my KBar, it runs the program as the root user? Thanks.
|
|
|
01-31-2002, 03:58 PM
|
#8
|
LQ Guru
Registered: Jan 2001
Posts: 24,149
|
i don't think what you asking is going to work.. you either need to make it so the regular user has ownership or permissions to use it or setup sudo.. unless you create your own script or something so when you open the program using a regular user account, it will auto login using su or root.. which in my own opinion isn't very safe for security reasons.
|
|
|
01-31-2002, 04:07 PM
|
#9
|
Member
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510
Original Poster
Rep:
|
Ok, how do I make it so the regular user can use this program?
When I try to mount using the program, I get an error message:
Quote:
smbmnt must be installed suid root for direct user mounts (500,500)
smbmnt failed:1
|
|
|
|
01-31-2002, 04:18 PM
|
#10
|
Member
Registered: Feb 2001
Location: Texas
Distribution: Slackware, Mandrake, LFS
Posts: 306
Rep:
|
As much as I probably shouldn't show you this.
chmod 4777 /path/to/smbmount
and no the 4 isn't a typo, it's called setuid or the sticky bit making the program run as root. Be warned tho, if you're on a multiuser system I would advise against doing this.
|
|
|
01-31-2002, 04:28 PM
|
#11
|
Member
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510
Original Poster
Rep:
|
Why would you advise against doing this, if I'm on a multiuser system?
edit: by the way, that worked, thanks.
Last edited by glock19; 01-31-2002 at 04:30 PM.
|
|
|
01-31-2002, 04:38 PM
|
#12
|
LQ Newbie
Registered: Jan 2002
Location: Hyderabad, India
Distribution: RedHat Linux
Posts: 1
Rep:
|
Set the Super User to that program
0. you must be root.
1. Open Konqueror,
2. go the the folder where you executable file "linNeighborhood" is present
3. Right-click on the executable file
4. choose properties
5. in the permission 'Tab'
6. enable 'setuid'
now you can run the program without entering root password.
|
|
|
01-31-2002, 04:44 PM
|
#13
|
Member
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510
Original Poster
Rep:
|
Does the "set user id" or "suid" bit make it so the file is always executed by whoever is the owner of that file (even if another user is logged in)?
Last edited by glock19; 01-31-2002 at 04:55 PM.
|
|
|
01-31-2002, 04:56 PM
|
#14
|
Member
Registered: Feb 2001
Location: Texas
Distribution: Slackware, Mandrake, LFS
Posts: 306
Rep:
|
read up on any vulnerability that has been exploited and 90% of them are because a program was setuid and crashed, giving a root shell(because of the elevated priviledges) or because of some exploit that let it run code. I'd be especially wary of a system that you are not the only user on, if it's multi user but still a personal machine then don't worry so much.
The samba team is also pretty good about programming style, so it's not exactly something I'd lose sleep over, but chmod 4777 always makes me cringe when I need to use it.
Setuid afaik makes the program run as root always, therefore you must be root to set it. To make a program run as a certain user's priviledge you'd need a wrapper I believe, but you can read up on that(I only know suid).
Last edited by jrmann1999; 01-31-2002 at 04:58 PM.
|
|
|
01-31-2002, 05:01 PM
|
#15
|
Member
Registered: Jan 2002
Location: NZ, AKL
Distribution: Redhat 7.1
Posts: 168
Rep:
|
If I was to make a script can I automaticly send the password to the su command?
like say it was something like (guessing)
./su
../usr/bin/bla
exit
I know it wouldn't be safe to send the password via a script but its a single user computer..
|
|
|
All times are GMT -5. The time now is 11:05 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|