2009/11/05

dropbear: scp does not work, here is poor man's replacement

The dropbear project provides very interesting implementation of SSH server. It has advantage of very low memory footprint, which might be crucial in case of embedded devices. Personally I use dropbear on NSLU2 device (aka SLUG).

I was a little bit disappointed when I tried scp command against dropbear server (on debian host):

$ scp .ssh/id_rsa.pub root@slug:authorized_keys
bash: scp: command not found
lost connection

Another try:

sftp root@slug
Connecting to slug...
bash: /usr/lib/sftp-server: No such file or directory
Connection closed

Dropbear comes without scp and sftp-server commands. On debian you can find them in openssh-server package. Installing it would bring a lot of unwanted dependencies not even mentioning that I would have to make sure that OpenSSH server is not going to start and compete with my little dropbear. Here is simple scp-like solution.

cat .ssh/id_rsa.pub | ssh root@slug 'tee authorized_keys >/dev/null'

I hope it will help someone.

3 comments:

  1. You'll find more useful tricks (also from archive and compression category, containing this one) at Linux commands.

    ReplyDelete
  2. Anonymous10/1/13 10:45

    You can include scp into dropbear with the right configuration. Best way is to create a MULTI Binary dropbear and then create a "scp" symlink to the dropbear binary.

    ReplyDelete
  3. it is not scp/sftp equivalent. better use this:

    tar czf .ssh/id_rsa.pub -T - | ssh root@slug 'tar xvzf -'

    using that command you save file attributes and you can transfer directory tree. Of course in this example you move content from source current dirrectory to destination current.

    ReplyDelete