Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
i added a path to rc.local in /etc but it does not seem to work. normally /sbin is not added to path in fedora and i added to .bashrc in ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2006
    Location
    London Uk
    Posts
    93

    adding a new path to all users[solved]


    i added a path to rc.local in /etc but it does not seem to work. normally /sbin is not added to path in fedora and i added to .bashrc in root and it works. i want to make sure this works for other users as well. as one would say, anyway /sbin/ files can be accessed or executed only by root but i want to make sure if su from terminal i should still be able to access all executables in /sbin instead of typing in /sbin/commandname.

    i have one more small doubt, if we export, where does it actually write to..any config file storing system variables...

  2. #2
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,134
    su -l should give you a "login" shell, complete with root's PATH.

  3. #3
    Just Joined!
    Join Date
    Aug 2006
    Location
    London Uk
    Posts
    93
    but where do you normally put the PATH variables if you want it to be available with for all users?

  4. #4
    Linux Newbie mazer's Avatar
    Join Date
    Jul 2006
    Location
    Tucson, Arizona, USA
    Posts
    109
    Quote Originally Posted by raghavan20
    i added a path to rc.local in /etc but it does not seem to work. normally /sbin is not added to path in fedora and i added to .bashrc in root and it works. i want to make sure this works for other users as well. as one would say, anyway /sbin/ files can be accessed or executed only by root but i want to make sure if su from terminal i should still be able to access all executables in /sbin instead of typing in /sbin/commandname.

    i have one more small doubt, if we export, where does it actually write to..any config file storing system variables...
    What shell are you using, bash? Either you add your path in /etc/profile or you write a small script in /etc/profile.d/
    mazer

  5. #5
    Just Joined!
    Join Date
    Aug 2006
    Location
    London Uk
    Posts
    93
    i am using bash shell as standard. can you show me an example how the script would look like?

  6. #6
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    hi raghavan20 !!!

    /etc/profile.d already have a lot of scripts to set user path for different libraries... check those scripts. you will get an idea....

    create a new file with extension .sh
    add the path value ...

    PATH=$PATH:<add path>
    export PATH

    <=== { casper } ===>
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  7. #7
    Just Joined!
    Join Date
    Aug 2006
    Location
    London Uk
    Posts
    93
    if i write a separate .sh shell script and if i put in the new path variables how do i make sure that they get executed when the system starts and they are globally available to all users?

  8. #8
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    hi raghavan20 !!!

    log in and check...
    $ echo $PATH

    <=== { casper } ===>
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  9. #9
    Just Joined!
    Join Date
    Aug 2006
    Location
    London Uk
    Posts
    93
    thanks casper,,,i understand now that all scripts under profile.d are executed when we login.

  10. #10
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,393
    /sbin, /usr/sbin etc are added to your path on Fedora Core. Its not just available for all users except root because of security reasons. If a normal user want to switch to root and run commands in /sbin, /usr/sbin etc, without entering the entire path, then they need to use "su -" which gives them a true root environment instead of "su".

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •