LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 08-30-2005, 06:05 AM   #1
CornMaster
LQ Newbie
 
Registered: Aug 2005
Distribution: Fedora Core 4
Posts: 18

Rep: Reputation: 0
When su to root, cannot use commands from sbin


When I su to root....I can't use any of the commands in sbin. I have to type the whole path. so /sbin/grub instead of just grub.

But if I login as root...it all works fine. And when I'm logged in as normal users their paths work fine too.

Someone told me I may have to edit my root path....but that's about all he said.
 
Old 08-30-2005, 06:35 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392
Hi,

You are probably using su and not su -.

The first (su) makes you root but the environment (PATH being one) stays as is (user that su-ed).
The second one (su -) gives you a login shell. This also takes care of PATH setting etc.

Both have their purpose.

Hope this helps.
 
Old 08-30-2005, 07:40 AM   #3
CornMaster
LQ Newbie
 
Registered: Aug 2005
Distribution: Fedora Core 4
Posts: 18

Original Poster
Rep: Reputation: 0
Yeah....I was using su.

What if I did su root. Would that give the environment?

I'm at work and can't test at home...I thought I had my SSH setup properly...guess I didn't.
 
Old 08-30-2005, 07:54 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392
Hi again,

su root will not solve your problem, the - (in su - <user) makes it a login shell, without the - you are stuck with the environment that is executing the su command.

BTW: su - is short for su - root.

Hope this helps.
 
Old 08-30-2005, 11:05 AM   #5
CornMaster
LQ Newbie
 
Registered: Aug 2005
Distribution: Fedora Core 4
Posts: 18

Original Poster
Rep: Reputation: 0
ahh...so the - give a whole new login.

So if I checked logged in users, it would show two?




Is there a way I can make /sbin/ into my regular users path?

If I did that, they could run the commands when su right? But they would HAVE to su inorder to have the permissions to run them?

For my laziness...that would seem to be the best solution. (Plus I like to fiddle with things. )
 
Old 08-30-2005, 11:25 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392
Quote:
ahh...so the - give a whole new login.

So if I checked logged in users, it would show two?
Not always, it depends on the command used.

Quote:
Is there a way I can make /sbin/ into my regular users path?

If I did that, they could run the commands when su right? But they would HAVE to su inorder to have the permissions to run them?
You could add /usr/sbin /sbin to your users path, but you shouldn't. You are correct about the permissions: Most (all?) programs in the sbin directories need at least membership to the root group, probably the user needs to be root.

Using su - instead of su is marginally more 'work', but even better: Take a look at sudo.

Sudo makes it possible to execute (specific) commands that need root permissions by (certain) users. Lots of things can be configured and it (almost) illiminates the need to become root.

Quote:
For my laziness...that would seem to be the best solution. (Plus I like to fiddle with things. )
If you like to fiddle: man sudo / http://www.courtesan.com/sudo/intro.html
 
Old 08-30-2005, 02:37 PM   #7
CornMaster
LQ Newbie
 
Registered: Aug 2005
Distribution: Fedora Core 4
Posts: 18

Original Poster
Rep: Reputation: 0
Hummm... sudo....I've seen it used, but never really knew what it was for. After looking at that config file, it seems like a lot of setup, but a more secure way to do what I want to do.

Thanks.
 
  


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
Root/User rights to Root commands? mrde50garfield Linux - Software 2 10-24-2006 06:42 AM
/sbin/rc: line 271: /sbin/devfsd: No such file or directory Alexander.s Linux - General 3 04-22-2005 05:44 PM
Want2use /sbin cmds undr non-root account w/o sudo. Is it safe 2 add /sbin 2 my PATH? kornerr Linux - General 4 02-25-2005 10:29 AM
$PATH for root to /sbin mickeyboa Fedora 6 01-15-2005 12:07 PM
As root, not seeing /sbin and /usr/sbin in path weghman Linux - Newbie 3 04-25-2004 02:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 11:44 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration