Find the answer to your Linux question:
Results 1 to 8 of 8
hi all, i'm logged as user 'lg' and typed su and prompts for passwd i gave the root passwd and logged into #. but when i type ifconfig - its ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,737

    Thumbs up what's difference bw su and su -root?


    hi all,
    i'm logged as user 'lg' and typed
    su and prompts for passwd i gave the root passwd and logged into #.
    but when i type ifconfig - its say no cmd found...but i can see ifconfig in /sbin/bin
    then i login again as using,
    su - root
    now ifconfig works ...why is it so..what's difference between loggin as
    su and su - root?
    Thanks
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    su doesn't add path of folders that have root access only in $PATH.
    check it:
    Code:
    su
    echo $PATH
    exit
    su -
    echo $PATH
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,737

    Smile

    thanks...yes..PATH varies for two...thanks...but is that the only difference between su and su - and there is no there difference??
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  4. #4
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,393
    If you use "su", you do not inherit any of the users environmental variables and settings e.g. the path whereas using "su -" spawns a new login shell with all the users variables and settings.

  5. #5
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    'su -' changes the present working directory too. its like dropping you at root shell.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  6. #6
    Just Joined!
    Join Date
    Jun 2007
    Posts
    1

    cool

    Cool thread , i am new member to this forum and really liked it

  7. #7
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    Welcome to the LinuxForums.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  8. #8
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,737

    Smile

    Thanks guyz..
    @ mis333 : welcome to linux forums ...enjoy and happy coding
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

Posting Permissions

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