Author Topic: commands  (Read 921 times)

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
commands
« on: 29 April 2002, 23:50 »
i am finally pissed off with putting /sbin/(command)
What do i need to do in order to "auto" add /sbin in front of my commands??
Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'

iancom

  • Member
  • **
  • Posts: 103
  • Kudos: 0
commands
« Reply #1 on: 30 April 2002, 00:01 »
Assumptions:

-You're using bash
-You need /sbin in the path of an ordinary user (ie not root - this would already be in root's path)

Naturally, you shouldn't add any of the sbin directories to global users' paths since the whole idea is that normal users won't accidentally run admin commands (even if they don't have the rights to do system-wide damage, they may screw up their own profile, get confused  etc).

So, to add it only to your own non-root path, login as that user (or su -) and

vi ~/.bash_profile

after

PATH=$PATH:$HOME/bin

add

:/sbin:/usr/sbin

and then log out and back in again... you should be able to run sbin commands without the full path.

Hope that helps!

Ian

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
commands
« Reply #2 on: 30 April 2002, 00:38 »
it isnt already part of roots path, but i did vi ~/.bash_profile from root and edited it to have that path.
But it still didnt work

[ April 29, 2002: Message edited by: Master of Reality ]

[ April 29, 2002: Message edited by: Master of Reality ]

Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'

iancom

  • Member
  • **
  • Posts: 103
  • Kudos: 0
commands
« Reply #3 on: 30 April 2002, 02:25 »
Very odd... but then I mostly use RedHat - maybe other distros don't default to including the sbin's in root's path?

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
commands
« Reply #4 on: 30 April 2002, 02:47 »
quote:
Originally posted by IanC:
Very odd... but then I mostly use RedHat - maybe other distros don't default to including the sbin's in root's path?

i am using red hat 7.2 but i usually find out some way to make it more difficult to myself whenever trying a new OS.
Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'

Nobber

  • Member
  • **
  • Posts: 89
  • Kudos: 55
commands
« Reply #5 on: 30 April 2002, 02:54 »
I'm using Debian, and /sbin is in my PATH when I log in as root. In fact, all three sbins are in there.
As sure as eggs is eggs.

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
commands
« Reply #6 on: 30 April 2002, 05:11 »
"/sbin" is in root's path in RedHat as well. I have a feeling that when you say you are logged on as root you actually did an "su". This does give you root authority but it does not load root's environment (PATH etc). If you want to switch to root and load root's environment you need to type "su -".

Now, type "echo $PATH" and tell me what's in your PATH. In order for your changes to take effect after changing your .bash_profile you need to either log off and log back on or type ". ~/.bash_profile".  That will only effect the shell you type the command in at least until you log off and log back on.
Someone please remove this account. Thanks...

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
commands
« Reply #7 on: 30 April 2002, 05:16 »
quote:
Originally posted by VoidMain:
"/sbin" is in root's path in RedHat as well. I have a feeling that when you say you are logged on as root you actually did an "su". This does give you root authority but it does not load root's environment (PATH etc). If you want to switch to root and load root's environment you need to type "su -".

Now, type "echo $PATH" and tell me what's in your PATH. In order for your changes to take effect after changing your .bash_profile you need to either log off and log back on or type ". ~/.bash_profile".  That will only effect the shell you type the command in at least until you log off and log back on.



yes i did "su" and i did "su -" and it does work. Now when i do "echo $PATH" it shows /bin:/sbin:/usr/sbin:and a few other places.
Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'