Find the answer to your Linux question:
Results 1 to 5 of 5
When I ssh into my machine, PATH isn't set properly, but when I su to the same user it appears as it should. I'm using Sabayon (a gentoo derivative) and ...
  1. #1
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    Location
    CA, but from N.Ireland
    Posts
    2,413

    setting PATH

    When I ssh into my machine, PATH isn't set properly, but when I su to the same user it appears as it should. I'm using Sabayon (a gentoo derivative) and I was wondering how I can make sure that my PATH is set correctly when I log in via ssh?

    FYI: When I ssh in, PATH is set to,
    Code:
    /usr/bin:/bin:/usr/sbin:/sbin
    When I su to the same user, PATH is set to,
    Code:
    /usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.1:/opt/blackdown-jdk-1.4.2.03/bin:/opt/blackdown-jdk-1.4.2.03/jre/bin:/usr/kde/3.5/bin:/usr/kde/3.5/bin:/usr/qt/3/bin:/usr/qt/3/bin:${NXDIR}/bin:/usr/games/bin
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

  2. #2
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    The complete PATH (the latter example you posted) appears to have a bunch of non-standard paths in it. Where are you setting that?

    If you're not sure, you can probably find out using something like
    Code:
    $ grep -R 'blackdown-jdk-1.4.2.03' /home/your_account

  3. #3
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    Location
    CA, but from N.Ireland
    Posts
    2,413
    Thanks anomie.

    The blackdown-jdk reference is some linux java thing, while the NXDIR folder is for fast, secure, X11 connections.

    This is a fresh (2 days old) installation of Sabayon linux, so my first post shows the default path.

    To fix the problem I originally posted about I created a .bashrc containing source /etc/profile, but I'd still like to understand why I didn't get a full path with ssh?
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

  4. #4
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    Based on your response, I'm thinking the answer to my question is that that complete PATH is set by /etc/profile then?

    If so, it's really strange. sshd does offer an AcceptEnv directive (which requires a SendEnv directive on the client side). I suppose it's possible you're passing in your PATH from the client..?

    What makes it extra strange is /usr/sbin:/sbin would usually only be in root's PATH.

    Nothing else obvious comes to mind.

  5. #5
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    Location
    CA, but from N.Ireland
    Posts
    2,413
    Quote Originally Posted by anomie View Post
    Based on your response, I'm thinking the answer to my question is that that complete PATH is set by /etc/profile then?
    I think so.

    Quote Originally Posted by anomie View Post
    If so, it's really strange. sshd does offer an AcceptEnv directive (which requires a SendEnv directive on the client side). I suppose it's possible you're passing in your PATH from the client..?
    I use the following command to find out the PATH I get with ssh,
    Code:
    ssh me@mycomputer "printenv PATH"
    So I'm not setting it at the client side. Of course, now that command gives the "right" path since I made the .bashrc.

    Quote Originally Posted by anomie View Post
    What makes it extra strange is /usr/sbin:/sbin would usually only be in root's PATH.
    This is pretty strange. I'd love to understand what's going on.

    Thanks for your input anomie.
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

Posting Permissions

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