Announcement

Collapse
No announcement yet.

26.04 LTS (How) Can I Get OpenSsh Client to Work In a Terminal Window?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    26.04 LTS (How) Can I Get OpenSsh Client to Work In a Terminal Window?

    I've been trying to use ssh to access remote servers. On any other system, I'd type "ssh foo@bar.baz.org" in the shell, and things would basically just work.

    On Kubuntu, I got a pop-up window asking for my password. The shell window told me something called ksshaskpass was involved.

    I asked on kde forums, and was told that it was safe to uninstall ksshaskpass.

    I did so. I then rebooted, and tried again.

    I then got responses in the shell like

    Code:
    ssh_askpass: exec(/usr/bin/ksshaskpass): No such file or directory
    ​I traced this to environment variables SSH_ASKPASS and SSH_ASKPASS_REQUIRE in my shell.

    I traced those to /etc/xdg/plasma-workspace/env/ksshaskpass.sh

    ​I traced *that* to the kbuntu-settings-desktop package (.deb).

    That package makes the openssh client non-functional unless you have the ksshaskpass package, but presumably doesn't declare the dependency.

    I fear that uninstalling kubuntu-settings-desktop would cause major breakage elsewhere in the desktop.


    So my question: Is it even possible, on kubuntu, to use the openssh client from a shell window, with all prompts answered in that shell window, and no involvement of any external password safe or similar?

    If so, how do I do it?

    In particular, how do I do it in a manner that will survive upgrading to the next LTS release, and then the LTS after that, not to mention installing new versions of packages in the meanwhile?

    Thanks for any enlightenment.
    Last edited by DinoNerd; Yesterday, 11:11 PM.

    #2
    I can only say that on my K 26.04, I use ssh in Konsole all the time to reach our (KFN's) server. No problems. I have ksshaskpass installed, although I've never done anything with it. openssh-client is also installed, and again, I've never done anything with it.
    Slava Ukraini! 🇺🇦
    Windows no longer obstruct my view.
    Using Kubuntu Linux since March 23, 2007.
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes​

    Comment


      #3
      Originally posted by Snowhog View Post
      I can only say that on my K 26.04, I use ssh in Konsole all the time to reach our (KFN's) server. No problems. I have ksshaskpass installed, although I've never done anything with it. openssh-client is also installed, and again, I've never done anything with it.
      Weird. I don't recall doing anything to it myself either. I did install openssh-server, but that shouldn't have had any effect here.

      One thing though: My system was first installed as the non-LTS immediately before 26.04, then upgraded. I've known upgrades to "fix" things in bad ways, but usually that takes many updates in a row.

      One other thing: there are breadcrumbs on the net that if you set various environment variables in your shell, you can get openssh to not use kssshaskpass even though it's present. I haven't pursued that; I'd have to reinstall ksshaskpass and then probably experiment a lot. Have you done something like this?

      Comment


        #4
        Originally posted by DinoNerd View Post
        I've been trying to use ssh to access remote servers. On any other system, I'd type "ssh foo@bar.baz.org" in the shell, and things would basically just work.

        On Kubuntu, I got a pop-up window asking for my password. The shell window told me something called ksshaskpass was involved.

        I asked on kde forums, and was told that it was safe to uninstall ksshaskpass.

        I did so. I then rebooted, and tried again.

        I then got responses in the shell like

        Code:
        ssh_askpass: exec(/usr/bin/ksshaskpass): No such file or directory
        ​I traced this to environment variables SSH_ASKPASS and SSH_ASKPASS_REQUIRE in my shell.

        I traced those to /etc/xdg/plasma-workspace/env/ksshaskpass.sh ...
        That script sets SSH_ASKPASS_REQUIRE=prefer, which tells ssh to use the graphical helper even when it runs in a terminal. You don't need to touch the package: putting unset SSH_ASKPASS_REQUIRE (or export SSH_ASKPASS_REQUIRE=never) in your ~/.bashrc brings back the normal password prompt in Konsole. Reinstalling ksshaskpass and keeping that line is probably the tidiest fix, because ssh-add started from the desktop session can still find the helper.

        Comment


          #5
          Originally posted by daria22 View Post

          That script sets SSH_ASKPASS_REQUIRE=prefer, which tells ssh to use the graphical helper even when it runs in a terminal. You don't need to touch the package: putting unset SSH_ASKPASS_REQUIRE (or export SSH_ASKPASS_REQUIRE=never) in your ~/.bashrc brings back the normal password prompt in Konsole. Reinstalling ksshaskpass and keeping that line is probably the tidiest fix, because ssh-add started from the desktop session can still find the helper.
          Progress. I've verified that I can get the host key into .ssh/known_hosts by doing the following in my shell.

          $ export SSH_ASKPASS_REQUIRE=never

          Better still, I can do it without (re-)installing the ksshaskpass package.

          I still need to make this setting automatic - hopefully my .bashrc will be run after /etc/xdg/plasma-workspace/env/ksshaskpass.sh and there won't be some corner case where it won't be run at all.

          Ssh still isn't working for me. It's decided that it won't use anything except a public key - no offer to accept a password. But that's probably happening at the server end, and can be worked around. (I don't need to be able to ssh from my kubuntu system in order to transfer a public key from that system to the target server, though it would certainly make things easier.)

          ​Doing things this way will probably break any graphical app that relies on ssh.(**) But AFAIK I don't use any such app. And I've been utterly unable to find a setting for SSH_ASKPASS_REQUIRE that will check whether ssh is run from a terminal window (***), rather than run with the DISPLAY environment variable unset(*). (At least, this presumes Gemini gave me correct answers. I couldn't find a human-authored web page or man page that explained the legal values, probably because google search gave answers for sssh_askpass rather than SSH_ASKPASS, and the Gemini embedded in Google search doesn't cite sources.)

          ---
          (*) If you want to be able to launch GUI apps from a terminal window, you have to have DISPLAY set. Not having DISPLAY set will distinguish a true terminal, but not a terminal window running on an X server (or, apparently, a Wayland server, which is what Kubuntu gave me.)

          (**) I'm presuming that never means "never," rather than "unless you can't find a tty device associated with your process". Of course it could have been coded to mean the latter, or something even less intuitive.

          (***) It would probably need to check whether there's an associated tty device, not just whether there's an interactive stdout and stderr. IIRC (I may not) ssh and similar rely on /dev/tty rather than stdout/stderr for things like password requests. Or at least they did, last time I was paying attention to such things.
          Last edited by DinoNerd; Today, 03:56 PM.

          Comment

          Users Viewing This Topic

          Collapse

          There are 0 users viewing this topic.

          Working...
          X