Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23

Thread: Terminal Path Command - echo $PATH - What Do You Know About Your PATH?

  1. #21
    Join Date
    Mar 2010
    Location
    Austin - Texas
    Posts
    10,140
    Blog Entries
    48

    Smile Re: Terminal Path Command - echo $PATH - What Do You Know About YourPATH?

    tsu2
    First, I'd like to say how cool this thread is.

    Since installing 11.3, I'd noticed little things about not finding myself in the expected directory location when su, sudo and logging in as root and this thread goes a long ways towards answering those mysteries. I don't remember these types of issues in 11.1 and earlier, has something changed and if so when? The only thing that looks familiar is in post #16 re suggested use creating a profile.local if you want to make any PATH changes persistent.

    I'm also disappointed that if implementing sudo instead of su (or su root) is supposed to be a significant security measure that it only requires an explicit path to access the /sbin/ folder and possibly other locations which you might want off limits. Is there a permissions issue beyond the scope of this thread (covering only $PATH)?

    Hoping I'm not getting too off -thread, I did a quick lookup of "su vs sudo" and the Wikipedia entry says that the file /etc/sudoers determines the environment and permissions of sudo. Inspecting that file on my default 11.3, unless I'm missing something although the environment is an alias of the ordinary user, the permissions are absolutely no different than root.

    So, what then really is the security advantage of using sudo instead of su?

    Thx,
    Tony
    hello tsu2 and thanks for joining the discussions. I see two differences about sudo over su. First, sudo can be used to preface a command, only using root permissions for a single command. This works on a command line or in a script, though the sudo command can run another script. Once the command is finished, you drop back to normal permissions. When using su, you have to use the exit command to leave the root permissions. So, I think it is better in my mind to use sudo and add the path when required. Second, it is possible for root to modify the /etc/sudoers to change the apparent similar operations of su and sudo for permissions, even if it is not done by default. So, my suggestion and opinion is to use sudo if you have the choice.

    tsu2, I would say that just like you, I also am learning here and expect to be corrected should I misspeak. I suggest that you do not get your feeling hurt, but rather your mind expanded. If you are like me, you get into a comfort zone, finding a couple of ways to do something while not realizing there can be a whole new horizon of knowledge and uses you never knew where there. Perhaps discussions about the path , su and sudo can do that for us.

    Also, thanks again for fine additions from please_try_again, ken_yap and DenverD. Your input is GREATLY appreciated here!

    Thank You,
    My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

    Software efficiency halves every 18 months, thus compensating for Moore's Law

    Its James again from Austin, Texas

  2. #22
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Terminal Path Command - echo $PATH - What Do You Know About YourPATH?

    You can use su to run a single command too, just do:

    su -c whoami

    Historically su has been there practically since the beginning of time. sudo came later. I would say the key difference is that sudo consults a rule file to selectively grant rights in various scenarios.

  3. #23
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: Terminal Path Command - echo $PATH - What Do You Know About YourPATH?

    jdmcdaniel3 wrote:
    > Now I seem to have some statements being made that are not true. That
    > is, that the su command, by its self does not provide any of the root
    > environment. But if you look at my path commands, it is changed when
    > you use just su, as in particular, the /sbin path is present.


    i don't know how to answer you, there is a pre-existing quite long
    discussion about "su" and "su -" here: http://tinyurl.com/ydbwssh
    in which several different folks claim different things about what
    happens with each...

    some folks started out believing one thing and ended up believing
    another...

    right now i have to run (out the door)..

    --
    DenverD
    When it comes to chocolate, resistance is futile.
    CAVEAT: http://is.gd/bpoMD [posted via NNTP w/openSUSE 10.3]

Page 3 of 3 FirstFirst 123

Tags for this Thread

Posting Permissions

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