Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
2  
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? –  Doon Dec 14 '12 at 14:33
    
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. –  cjc Dec 14 '12 at 16:40
1  
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. –  Zoredache Dec 27 '12 at 18:03
    
@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. –  Marc Jan 10 '13 at 20:05
    
@Zoredache works well thanks. –  Marc Jan 10 '13 at 20:11

1 Answer 1

up vote 1 down vote accepted

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|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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