2

I'm trying to build OpenSSH 7.9p1 from source, but I can't find a way to delete (or not include), for instance, ssh-agent, ssh-keygen, scp, sftp, sshd, etc. – of course, assuming none of those are required for the ssh command to work.

Ideally I would only need the client: the ssh command, but again, I'm not sure what other pieces are required. I think most of what's build/installed is used by the server, not by the client.

  • Please tell us why you need a special openssh-client: 1. Are you running or creating a linux distro? Please tell us about your operating system. 2. Are you creating some 'fool-proof' system with client computers, that can only run a few necessary programs, and one of them is ssh, but not transfer files, so you want to remove sftp and scp ? 3. Or something else? – sudodus Jan 30 at 8:03
  • 1
    I have to build it from source, it's to make a Flatpak, and the SSH client is a dependency. I don't want to shovel everything-SSH there if it's not needed. I was going the route @JeffSchaller proposed but I first wanted to know if there was another way. I can identify the location(s) where the other (potentially) unneeded files are "installed" and remove them, but like I said I would like to avoid that if there is a way to tell configure to not consider some "packages", etc. For instance, the openssh-client from Ubuntu would be perfect for me case, but I can't use a .deb file. – x80486 Jan 30 at 12:50
3

Yes, you can do this with the default build system provided.

If you look at the Makefile that is generated by running the provided ./configure script, you should see that the default (first) target is

TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-pkcs11-helper$(EXEEXT) ssh-agent$(EXEEXT) scp$(EXEEXT) sftp-server$(EXEEXT) sftp$(EXEEXT)

(for Unix-like systems, $(EXEEXT) should be empty). Each has its own separate build target / rule so for example you can do:

make ssh

to make only the client.

Ex.

$ make ssh

<snip>

$ find . -type f -executable -newermt yesterday
./config.status
./ssh

$ ./ssh -V
OpenSSH_7.9p1, OpenSSL 1.1.0g  2 Nov 2017
  • Great, let me try that first and I'll accept your answer. Thanks for the info! – x80486 Jan 30 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.