===== Copying files from host to starterkit ===== There are several options to copy files to the starterkit, in this tutorial we decribe how to do this. ==== Using NFS to copy files between Ubuntu 14.04 and STK ==== To use NFS file sharing you need the package 'nfs-kernel-server', you also need to create the file /etc/exports on the host machine. Inside /etc/exports is a list of exportable filesystems which you need to set up manually. The filesystem we export in this tutorial is /home/embedded. The contents of the file are as follows: ++++ /etc/exports | # /etc/exports: the access control list for filesystems which may be exported # to NFS clients. See exports(5). # # Example for NFSv2 and NFSv3: # /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check) # # Example for NFSv4: # /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check) # /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check) # /home/embedded/test (rw,async) ++++ After this file was changed the NFS server should be restarted: user@ubuntu:~$ sudo service nfs-kernel-server restart To access the specified filesystem from your starterkit you need to run the following command: mount -o nolock [HostIP]:[specified_filesystem] [target_filesystem] ++++ example: | root@MBa6x: mount -o nolock 192.168.37.121:/home/embedded/test /media ++++ ==== Using SCP/ SSH ==== To copy files to your starterkit make sure you have the openssh-server package installed on your host machine. Openssh-server comes standard with our BSP, you do not need to further adapt it to use ssh. To copy a file from the host to the starterkit via ssh you need the scp command. The port through which STK and Host communicate is 22 by default. The scp command looks like this: scp [Host user]@[Host IP-address]:[path of the file on host machine] [target path on STK] ++++ example | root@MBa6x:~ scp embedded@192.168.37.121:/home/embedded/test /home ++++ ==Troubleshooting:== If access to the host system is denied, make sure the ssh-server on the host machine is listening to the right port and is able to communicate through the firewall. To check if the Server is listening to the right port use this command: sudo netstat -anp | grep sshd ++++ what it should look like: | tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 4774/sshd tcp6 0 0 :::22 :::* LISTEN 4774/sshd ++++ If the ssh-server is not listening to tcp 0 0.0.0.0:22 you need to open a new port. To do that you need to edit the sshd_config file. sudo nano /etc/ssh/sshd_config ++++ This is what sshd_config should ideally look like: | GNU nano 2.2.6 File: /etc/ssh/sshd_config # Package generated configuration file # See the sshd_config(5) manpage for details # What ports, IPs and protocols we listen for Port 22 # Use these options to restrict which interfaces/protocols sshd will bind to #ListenAddress :: #ListenAddress 0.0.0.0 Protocol 2 # HostKeys for protocol version 2 HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key HostKey /etc/ssh/ssh_host_ecdsa_key HostKey /etc/ssh/ssh_host_ed25519_key #Privilege Separation is turned on for security UsePrivilegeSeparation yes # Lifetime and size of ephemeral version 1 server key KeyRegenerationInterval 3600 ++++ If your sshd_config looks like this and you are still denied access to the host machine, use the following command open the host systems firewall to port 22: sudo ufw allow 22