LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-07-2006, 06:41 AM   #1
ravi.patil
LQ Newbie
 
Registered: Mar 2006
Posts: 2

Rep: Reputation: 0
how to run root command having normal user permission


Hi,
I want to run some root commands.I am having normal user permission.I have tried with setuid bit?

i followed followig steps.

$ cp mkdir ~/test
$ chmod 4776 test
$ ls -l test
-rwsrwxrw- 1 u03125 b-03 20888 2006-03-07 17:49 test
$ ./test /usr/bin/ttfonts
./test: cannot create directory `/usr/local/bin/ttfots'ermission denied


can any body help me out how to do this?
 
Old 03-07-2006, 06:49 AM   #2
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
The SETUID bit means the command will run as the owner of program and not as the current user.
To this work, you need to change the owner of test from u03125 to root: "chown root test".

cheers
 
Old 03-07-2006, 07:04 AM   #3
ravi.patil
LQ Newbie
 
Registered: Mar 2006
Posts: 2

Original Poster
Rep: Reputation: 0
hi this is also saying
"failed to change ownership of `test' to root
chown: changing ownership of `test': Operation not permitted
"

what the cause of it?
 
Old 03-07-2006, 07:34 AM   #4
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
Only root can do that !
Otherwise, this will be a big security hole, isn't ?
 
Old 03-07-2006, 07:35 AM   #5
muha
Member
 
Registered: Nov 2005
Distribution: xubuntu, grml
Posts: 451

Rep: Reputation: 38
You need to be root for "chown root test".
 
Old 03-07-2006, 07:56 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
OP wants to know how to run commands that need root access, but he does not have that...right?

Only option is sudo. If you do not have adequate privileges using sudo, then you need to find the administrator for the machine.
 
Old 05-21-2006, 02:06 PM   #7
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
I'm trying to do the same thing. I'm trying to run a script as a normal user but I want to write a file to a location that only root can.

Code:
-rwsrwxrwx    1 root     root           37 May 21 10:44 writetest.sh

[twantrd@trdlinux twantrd]$ /tmp/writetest.sh
touch: creating `/etc/writetest': Permission denied
Here is the script 'writetest.sh'
Code:
#!/bin/bash

touch /etc/writetest

Any ideas?

-twantrd
 
Old 05-21-2006, 02:21 PM   #8
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
Argh, nevermind. Went drinking last night. Anyhow, Linux doesn't read the suid bit on scripts.

-twantrd
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you connect to internet as normal user without run pppd as root ? nasty_daemon Linux - Networking 2 09-13-2005 01:43 AM
How can give ROOT permission to a NORMAL USER bipinkdas Linux - Software 2 06-23-2005 11:03 PM
permission problems for normal user c0d3-z3r0 Linux - Newbie 7 06-12-2004 08:02 PM
Hi, How to view user and root run command on linux? dEMax Linux - General 1 09-12-2003 04:22 AM
Is their a way to run a command as root..or another user.. in php BaerRS Programming 2 04-25-2002 02:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:08 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