LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-30-2002, 08:21 PM   #1
glock19
Member
 
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510

Rep: Reputation: 32
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.
 
Old 01-30-2002, 08:23 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
change the permissions of the file or ownership.

man chmod ( change permissions )
man chown ( ownership )

-trickykid
 
Old 01-30-2002, 08:47 PM   #3
glock19
Member
 
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510

Original Poster
Rep: Reputation: 32
I don't understand what that has to do with it. The program file already has chmod 777 and is owned by root.
 
Old 01-30-2002, 09:09 PM   #4
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
chown the proggy for the user
as root
chown userid:usergroup
 
Old 01-30-2002, 10:08 PM   #5
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
or look into sudo...
 
Old 01-31-2002, 03:55 AM   #6
dorward
Member
 
Registered: Sep 2001
Distribution: Gentoo
Posts: 760

Rep: Reputation: 31
Don't suid LinNeightborhood. suid smbmount and smbumount
 
Old 01-31-2002, 03:31 PM   #7
glock19
Member
 
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510

Original Poster
Rep: Reputation: 32
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.
 
Old 01-31-2002, 03:58 PM   #8
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
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.
 
Old 01-31-2002, 04:07 PM   #9
glock19
Member
 
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510

Original Poster
Rep: Reputation: 32
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
 
Old 01-31-2002, 04:18 PM   #10
jrmann1999
Member
 
Registered: Feb 2001
Location: Texas
Distribution: Slackware, Mandrake, LFS
Posts: 306

Rep: Reputation: 30
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.
 
Old 01-31-2002, 04:28 PM   #11
glock19
Member
 
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510

Original Poster
Rep: Reputation: 32
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.
 
Old 01-31-2002, 04:38 PM   #12
asifalirizwaan
LQ Newbie
 
Registered: Jan 2002
Location: Hyderabad, India
Distribution: RedHat Linux
Posts: 1

Rep: Reputation: 0
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.
 
Old 01-31-2002, 04:44 PM   #13
glock19
Member
 
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510

Original Poster
Rep: Reputation: 32
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.
 
Old 01-31-2002, 04:56 PM   #14
jrmann1999
Member
 
Registered: Feb 2001
Location: Texas
Distribution: Slackware, Mandrake, LFS
Posts: 306

Rep: Reputation: 30
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.
 
Old 01-31-2002, 05:01 PM   #15
dj_relentless
Member
 
Registered: Jan 2002
Location: NZ, AKL
Distribution: Redhat 7.1
Posts: 168

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


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
How can I launch a program? dave_moss Linux - Newbie 3 11-15-2005 08:43 AM
launch a program from the menu? managerdan Linux - Software 2 06-11-2005 09:06 PM
unable to open apps when 'su'ing to root from user account ganja_guru Linux - Software 3 06-03-2005 11:51 AM
i can't launch a program remotly Paxmaster Linux - Networking 4 03-12-2005 12:12 PM
Bash to Auto Launch a Program???? embsupafly Linux - Software 1 07-27-2004 01:25 AM

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

All times are GMT -5. The time now is 11:05 PM.

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