LinuxQuestions.org
Visit Jeremy's Blog.
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 11-27-2007, 06:33 PM   #1
usafitz
Member
 
Registered: Feb 2004
Location: Albuquerque
Distribution: Fedora 9
Posts: 46

Rep: Reputation: 15
suid / su questions


hey all. Quick question if you have a few minutes. Anytime I try to do suid anything, it asks me for a password. When I put in my root password, it says it's invalid. I can switch user using su and put in the root/password and things work fine. What do I not know about suid that I can use to get this to work?

Also, I can't run ifconfig or iwconfig under my user account but I can under root. I try to use the suid command, but run into the above problem. Any advice on this one?

Thanks for the help.
 
Old 11-27-2007, 09:17 PM   #2
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,443

Rep: Reputation: 74
I don't think ifconfig or iwconfig are in your path, but you should be able to run them (at least for viewing the current configuration). To see if something is in your path try

Code:
which COMMAND
ifconfig, for instance, should be under /sbin so try

Code:
/sbin/ifconfig
suid just runs a process with root privileges. I doubt you modified the binary file's perms to do this so I'm guessing you are really talking about sudo. If sudo is setup to give your user permissions for a command then you can use it, BUT you are supposed to enter in your password (NOT root's).
 
Old 11-27-2007, 10:48 PM   #3
usafitz
Member
 
Registered: Feb 2004
Location: Albuquerque
Distribution: Fedora 9
Posts: 46

Original Poster
Rep: Reputation: 15
Thanks Shadowsnipes, that's what I was looking for. sudo was what I was referring to.

so how can I make it to where my user can run the commands? Can I just copy the /bin folder to /home/user/bin or is there a way to let user reference the /bin library?

also, with sudo, I put in the user password but it tells me that "user is not in the sudoer file". how can I give sudo privileges to user? (I've been using my root account for playing around because of this and I'd like to remedy it).
 
Old 11-27-2007, 11:08 PM   #4
cojo
Member
 
Registered: Feb 2003
Location: St. Louis
Distribution: RedHat 8
Posts: 262

Rep: Reputation: 31
Quote:
Originally Posted by usafitz View Post
Thanks Shadowsnipes, that's what I was looking for. sudo was what I was referring to.

so how can I make it to where my user can run the commands? Can I just copy the /bin folder to /home/user/bin or is there a way to let user reference the /bin library?

also, with sudo, I put in the user password but it tells me that "user is not in the sudoer file". how can I give sudo privileges to user? (I've been using my root account for playing around because of this and I'd like to remedy it).
you need to run visudo to add your users to the sudoers list. Just follow the example within the sudoers file. As for the commands itself, you can add all /sbin, /bin, /usr/bin, and /usr/sbin to your user path.
 
Old 11-27-2007, 11:37 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,442

Rep: Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791
I'd recommend using the visudo approach. The access restriction is there for a reason (security).
For anyone else reading this thread:
sudo asks you for YOUR passwd, su (or su -) asks for the target user's passwd, by default root unless you specify another username, in which case their passwd.
 
Old 11-28-2007, 06:51 AM   #6
usafitz
Member
 
Registered: Feb 2004
Location: Albuquerque
Distribution: Fedora 9
Posts: 46

Original Poster
Rep: Reputation: 15
awesome, I'll take that approach. Thanks for the advice.
 
Old 11-28-2007, 10:38 AM   #7
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,443

Rep: Reputation: 74
On my desktop I am the only user that needs any kind of admin privileges so I don't use sudo. I prefer to simply make my user a part of the wheel group which allows me to su to root. I then use my fourth virtual desktop ONLY for root activities. I also setup a screen profile for root so that when I use screen it sets up a couple of nodes for tailing logs, and another for a regular local prompt. Using this, I only need one virtual terminal for root.

Even when using distros that make a lot of use of sudo, such as Ubuntu, I tend to prefer keeping a root terminal on my last virtual desktop so I can get admin work done quicker. Obviously if you need to have some users that only have certain root privileges, sudo is the preferred method.
 
Old 11-28-2007, 07:38 PM   #8
usafitz
Member
 
Registered: Feb 2004
Location: Albuquerque
Distribution: Fedora 9
Posts: 46

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by cojo View Post
you can add all /sbin, /bin, /usr/bin, and /usr/sbin to your user path.
How can I do this?
 
Old 11-28-2007, 11:13 PM   #9
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,443

Rep: Reputation: 74
I wouldn't recommend adding /sbin and /usr/sbin to a regular users path. Just type /sbin or /usr/sbin in front of those specific commands you want to run (eg. /sbin/ifconfig).

To change your PATH (or any environment variable) you simple use export

Code:
export PATH="/some/path:/some/other/path:$PATH"
Notice I included the current variable in their so the command only adds to it. This of course is only temporary for the terminal you run it in.

If you want to make it permanent you might want to change it in your .profile script. If you don't know what I am talking about search around in the forums for .bashrc

Please note that if you simply su as root you won't have to worry about the path or typing "sudo" for all of your commands!

Code:
su -
Type in the root password and you're root. Just set that terminal aside or change its color so you don't get in the habit of using it for stuff you don't need it for.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Suid? whishkah Linux - Software 5 09-07-2006 02:17 PM
suid pppoe Santas Linux - Security 0 10-18-2004 05:42 PM
suid peculiarities navawatanasob Linux - Security 2 09-17-2004 06:42 PM
SUID C function untwisted Programming 10 03-22-2004 07:19 PM
SUID file drops suid bit on append? c_coder Programming 1 03-12-2004 07:59 AM

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

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