ubuntu 12.10/linux mint 14 ssh-copy-id doesn't work and returns Ambiguous output redirect

7,774

This is what worked for me, thanks to Zoredache.

Be sure to replace $REMOTE_HOST with the host. NOTE: This assumes certain directories.

cat ~/.ssh/id_rsa.pub | ssh $REMOTE_HOST 'umask 077; mkdir -p ~/.ssh; cat >> ~/.ssh/authorized_keys'
Share:
7,774

Related videos on Youtube

Marc
Author by

Marc

Updated on September 18, 2022

Comments

  • Marc
    Marc over 1 year

    I recently got a new computer and I'm trying to use ssh-copy-id to put my keys on another server so I can login without password. but when I try

    ssh-copy-id -i ~/.ssh/id_rsa.pub user@server
    

    and after inputting the correct password it returns

    Ambiguous output redirect.
    

    There are no other messages after that. I thought it was maybe just Ubuntu 12.10 so I installed Linux Mint 14 and sure enough exact same thing happens.

    I've tried removing authorized_keys from the remote server but that didn't change anything.

    • Doon
      Doon over 11 years
      Does it happen on all servers, or just that one server? ssh-copy-id is just a shell script that open ssh, and runs some commands. So I am guessing that perhaps their is something odd with the shell on the server you are connecting to?
    • cjc
      cjc over 11 years
      I think Doon is on the right track. Does the shell emit weird characters when it starts up (this is something that breaks rsync when transporting over ssh)? Check your .bash_profile, .bashrc or whatever you've set up for a shell.
    • Zoredache
      Zoredache over 11 years
      ssh-copy-id is a trivial shell script. Why not just try manually running the required commands. cat pubkey | ssh remote 'umask 077; mkdir -p .ssh; cat >> .ssh/authorized_keys' If that doesn't work, connect to the box, and try manually running those commands.
    • Marc
      Marc over 11 years
      @Doon I've tried on 3 of my web servers, 1 x FreeBSD 7.3 and 2 x FreeBSD 7.4. It does work however when I try to ssh-copy-id to a local CentOS box and if I try to ssh-copy-id from this CentOS box to any of the 3 web servers it works fine. As a side note, when I do ssh-copy-id from the CentOS box I get a 26 outputted on the screen when I try to shh-copy-id to the web servers.