Opened 16 years ago

Closed 15 years ago

#2468 closed bug (fixed)

User logged in via ssh seems to have incorrect paths

Reported by: anevilyak Owned by: scottmc
Priority: normal Milestone: R1
Component: Applications/Command Line Tools Version: R1/pre-alpha1
Keywords: Cc: siarzhuk
Blocked By: Blocking:
Platform: All

Description

If I log into Haiku via ssh, the environment I get is very different from what I get on a local Terminal.

Specifically, the PATH that's set up is: "/usr/bin:/bin:/usr/sbin:/sbin:/boot/home/config/bin"

Whereas from Haiku's Terminal directly I get: ".:/boot/home/config/bin:/boot/common/bin:/bin:/boot/apps:/boot/preferences:/boot/beos/apps:/boot/beos/preferences:/boot/develop/tools/gnupro/bin"

Attachments (2)

openssl-1.0.0.diff (3.1 KB ) - added by scottmc 15 years ago.
first pass at fixing the directory issues with openssh, this patch add new builds of openssh, openssl and some libs that depend on openssl.
openssl-1.0.0.2.diff (3.0 KB ) - added by scottmc 15 years ago.
Updated patch, this one puts the sshd keys in common settings directory

Download all attachments as: .zip

Change History (14)

comment:1 by siarzhuk, 15 years ago

Cc: siarzhuk added

comment:2 by scottmc, 15 years ago

Owner: changed from bonefish to scottmc
Status: newin-progress

This might be fixed with a simple build time setting: http://lists.mindrot.org/pipermail/openssh-unix-dev/2010-April/028490.html I'll give it a try on the next openssh update.

by scottmc, 15 years ago

Attachment: openssl-1.0.0.diff added

first pass at fixing the directory issues with openssh, this patch add new builds of openssh, openssl and some libs that depend on openssl.

comment:3 by scottmc, 15 years ago

I've attached a patch that added the newly released openssl-1.0.0 to haiku, and also a handful of packages that depend on openssl that needed to be rebuilt, including openssh. Attaching this here as I'm also trying to fix this ticket with the new openssh builds. Please test and provide some feedback. I have moved the location of some of openssh's files, so if they don't seem to be in the right place let me know where they should go. This is just a first pass, note all of these packages are hosted on BeDrivers.com for now.

comment:4 by stippi, 15 years ago

Can you please outline the locations of files and your reasoning? I have no clue about OpenSSL and where stuff should go, so if you write "some files" I wouldn't know what to look for, but I am still interested to get a clue.

comment:5 by scottmc, 15 years ago

Sure. Here's what's in the zip file, and how I configured the build. Note that it now puts the .ssh directory in /boot/home/config/settings/ssh instead of ~/home/.ssh

Archive:  /boot/home/Desktop/openssh-5.4p1-x86-gcc2-2010-04-08.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
      118  04-08-10 16:09   .OptionalPackageDescription
        0  04-08-10 16:09   common/
        0  04-08-10 16:09   common/bin/
    55412  04-08-10 16:09   common/bin/scp
    90272  04-08-10 16:09   common/bin/sftp
        5  04-08-10 16:09   common/bin/slogin
   391592  04-08-10 16:09   common/bin/ssh
   120304  04-08-10 16:09   common/bin/ssh-add
   103472  04-08-10 16:09   common/bin/ssh-agent
   167228  04-08-10 16:09   common/bin/ssh-keygen
   217828  04-08-10 16:09   common/bin/ssh-keyscan
   454768  04-08-10 16:09   common/bin/sshd
        0  04-08-10 16:09   common/data/
        0  04-08-10 15:26   common/data/licenses/
    16000  04-08-10 15:26   common/data/licenses/OpenSSH
        0  04-08-10 16:09   common/lib/
    59456  04-08-10 16:09   common/lib/sftp-server
   225968  04-08-10 16:09   common/lib/ssh-keysign
    90572  04-08-10 16:09   common/lib/ssh-pkcs11-helper
        0  04-08-10 16:09   common/man/
        0  04-08-10 16:09   common/man/man1/
     4518  04-08-10 16:09   common/man/man1/scp.1
    11641  04-08-10 16:09   common/man/man1/sftp.1
        7  04-08-10 16:09   common/man/man1/slogin.1
     4245  04-08-10 16:09   common/man/man1/ssh-add.1
     5090  04-08-10 16:09   common/man/man1/ssh-agent.1
    19052  04-08-10 16:09   common/man/man1/ssh-keygen.1
     3914  04-08-10 16:09   common/man/man1/ssh-keyscan.1
    39969  04-08-10 16:09   common/man/man1/ssh.1
        0  04-08-10 16:09   common/man/man5/
     2665  04-08-10 16:09   common/man/man5/moduli.5
    30829  04-08-10 16:09   common/man/man5/ssh_config.5
    29697  04-08-10 16:09   common/man/man5/sshd_config.5
        0  04-08-10 16:09   common/man/man8/
     2342  04-08-10 16:09   common/man/man8/sftp-server.8
     1394  04-08-10 16:09   common/man/man8/ssh-keysign.8
      560  04-08-10 16:09   common/man/man8/ssh-pkcs11-helper.8
    29297  04-08-10 16:09   common/man/man8/sshd.8
        0  04-08-10 16:09   common/settings/
        0  04-08-10 16:09   common/settings/ssh/
   125811  04-08-10 16:09   common/settings/ssh/moduli
     1555  04-08-10 16:09   common/settings/ssh/ssh_config
     3240  04-08-10 16:09   common/settings/ssh/sshd_config
 --------                   -------
  2308821                   43 files

Here's my configure line from http://ports.haiku-files.org/browser/haikuports/trunk/net-misc/openssh/openssh-5.4p1.bep

./configure --prefix=`finddir B_COMMON_DIRECTORY` \
--sbindir=`finddir B_COMMON_BIN_DIRECTORY` \
--bindir=`finddir B_COMMON_BIN_DIRECTORY` \
--libexecdir=`finddir B_COMMON_LIB_DIRECTORY` \
--sysconfdir=`finddir B_USER_SETTINGS_DIRECTORY`/ssh \
--libdir=`finddir B_COMMON_LIB_DIRECTORY` \
--includedir=`finddir B_COMMON_DIRECTORY`/include \
--datadir=`finddir B_COMMON_DATA_DIRECTORY` \
--mandir=`finddir B_COMMON_DIRECTORY`/man \
--docdir=`finddir B_COMMON_DOCUMENTATION_DIRECTORY` \
--sysconfdir=`finddir B_COMMON_SETTINGS_DIRECTORY`/ssh \
--with-default-path=PATH \
--with-md5-passwords

comment:6 by scottmc, 15 years ago

Oh, and here's the other piece of the puzzle, this is where the pathnames get set and things got sketchy for me: http://ports.haiku-files.org/browser/haikuports/trunk/net-misc/openssh/patches/pathnames-haiku.h These are hardcoded, eventually we'd like to get these to use find_directory. Note that I put HAIKU_ in place of BE_ for these defines.

in reply to:  5 comment:7 by kaliber, 15 years ago

Replying to scottmc:

Here's my configure line from http://ports.haiku-files.org/browser/haikuports/trunk/net-misc/openssh/openssh-5.4p1.bep

> ./configure --prefix=`finddir B_COMMON_DIRECTORY` \
> --sbindir=`finddir B_COMMON_BIN_DIRECTORY` \
> --bindir=`finddir B_COMMON_BIN_DIRECTORY` \
> --libexecdir=`finddir B_COMMON_LIB_DIRECTORY` \
> --sysconfdir=`finddir B_USER_SETTINGS_DIRECTORY`/ssh \
> --libdir=`finddir B_COMMON_LIB_DIRECTORY` \
> --includedir=`finddir B_COMMON_DIRECTORY`/include \
> --datadir=`finddir B_COMMON_DATA_DIRECTORY` \
> --mandir=`finddir B_COMMON_DIRECTORY`/man \
> --docdir=`finddir B_COMMON_DOCUMENTATION_DIRECTORY` \
> --sysconfdir=`finddir B_COMMON_SETTINGS_DIRECTORY`/ssh \
> --with-default-path=PATH \
> --with-md5-passwords

I have a few comments:

  1. "--sysconfdir" is used twice
  1. Is /boot/common/etc deprecated? Should we use B_COMMON_SETTINGS_DIRECTORY (/boot/common/settings) now? The same situation is with /boot/common/share and B_COMMON_DATA_DIRECTORY (/boot/common/data).
  1. pathnames-haiku.h contains different paths comparing to configure settings, something is wrong here
  1. What path is preferred for manuals? I use /boot/common/share/man instead of /boot/common/man

comment:8 by scottmc, 15 years ago

Not sure what we should have for --sysconfdir, I suspect it's B_COMMON_SETTINGS_DIRECTORY. Which paths did you see that were different between configure and pathnames-haiku.h? As for the preferred directory for man files? Perhaps B_TRASH_DIRECTORY ;)

comment:9 by scottmc, 15 years ago

with HaikuPorts r701 I have moved the sshd keys to the common settings directory instead of common/etc.

New diff file attached, this also updated git to 1.7.0.5. This still needs to be tested.

by scottmc, 15 years ago

Attachment: openssl-1.0.0.2.diff added

Updated patch, this one puts the sshd keys in common settings directory

comment:10 by scottmc, 15 years ago

This might be fixed in hrev36326. Needs some testing.

comment:11 by augiedoggie, 15 years ago

The problem is more than just the PATH variable. It is because Haiku uses SetupEnvironment and UserSetupEnvironment scripts to set up a large number of variables. IMO the solution would be to make a change near the top of /etc/profile with an addition such as:

[[ -z ${BE_C_COMPILER} ]] && source /boot/system/boot/SetupEnvironment

comment:12 by bonefish, 15 years ago

Resolution: fixed
Status: in-progressclosed

Applied a similar patch from #5789 in hrev36536.

Note: See TracTickets for help on using tickets.