# Reminder to me -- I need to mkdir the recording folder on nao.
I often want to transfer files to and from my NAO from within my program. To do this without it asking for a password, I have to use public keys.
Example usage:
In Python, I can use the os.system() function to run linux commands.
import os
cmd = 'scp nao@nao.local:/home/nao/recording.wav .'
cmd = 'scp nao@nao.local:/home/nao/recording.wav .'
os.system(cmd)
This would copy the recording I made (for example, using the ALAudioDevice API) to the current directory on my Mac (for example).
How to scp from your computer to NAO without a password:
1. If you don't already have a public key, generate one:
- In the home directory of your computer, run ssh-keygen
- Press enter to name it using the default id_rsa.pub
- Enter some passphrase (at least 5 characters)
2. Copy the public version of the key to your NAO:
scp ~/.ssh/id_rsa.pub nao@nao.local:~
4. Add the public key to NAO's authorized keys list:
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
Even cooler!
You can do
cmd = 'scp nao.local:/home/nao/recording.wav .'
Adding a default username for nao.local host:
Add the following into ~/.ssh/config:
Host nao.local
User nao
Note that before "User" you need to put a tab.
Is it possible to copy file from nao to computer with scp?
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteI mean, is scp command is installed in Nao robot?
ReplyDelete