Showing posts with label openindiana. Show all posts
Showing posts with label openindiana. Show all posts

Monday, February 3, 2014

Run @PyCharm on #IllumOS and Solaris

Yes, it works


Go and check out Solaris Desktop for the details. The only challenge is in downloading the file. Then you will be able to enjoy PyCharm on IllumOS, stormOS, OpenIndiana, Solaris, Nexenta, SmartOS etc.

François
@f_dion

Thursday, October 11, 2012

Framboise a la mode arduino

C'est un jeu d'enfant


Vous aimez le petit support en lego? J'ai trouvé quelques pièces, pas assez pour faire un boitier, mais assez pour faire un support.




Mais, bon, mon Raspberry Pi s'ennuyait tout seul, il lui fallait donc un copain.

Le copain l'Arduino


C'est un Arduino uno. J'en utilise une bonne quantité de ces petits boards a la sauce atmega328. D'ailleurs ce matin, 10 de Octobre, je m'en suis procuré d'autres, a seulement $20 l’unité chez un revendeur sur Amazon - ça c'est vendu en quelques minutes a ce prix. Ca se trouve aussi moins cher, a $15, mais il faut alors attendre des semaines car cela vient de Chine.

C'est une plateforme libre utilisant des microcontrôleurs Atmel, Arduino se référant a la plateforme avec son interface pour carte filles, et Uno a un des modèles.

Je travaille en ce moment sur un projet international avec des Arduino (mon 7ieme projet commercial de ce type) et je vais probablement en commencer un autre vers la fin du mois qui lui ne va pas rester sur Arduino. Le prototype sera sur Arduino, mais le produit final,  ce sera sur le même microcontroleur Atmel Atmega328 avec une carte mère spécialisée.

Quand j'ai commencé avec les microcontrôleurs dans les années 90, il fallait tout faire soit même, et ecrire tout en code machine. Altera, Xilinx, PIC... Maintenant, avec les Arduino Uno et les Parallax Propeller c'est assez simple, c'est comme jouer avec des Lego :)



Ca se branche par le port USB (ou serie). Mon alimentation du Raspberry Pi (une alimentation de mobile Blackberry de 700mA) est suffisante pour alimenter le Arduino uno directement par le port USB:


Par contre si on branche un "shield" (c'est ainsi que l'on appelle les cartes filles en langage Arduino), il n'y a pas assez de jus pour alimenter le shield, sa LED reste éteinte (mais le Arduino lui est ok):


Il faudra donc utiliser une alimentation externe pour cela. Le arduino peut etre alimenter en 5V par USB ou en externe en 7V-12V. Donc ceci fera bien l'affaire, 12VDC 2A:


Je le branche directement a l'Arduino. J'aurais pu le connecter au shield lui-même, mais il y a un avantage a faire cela. Vous allez voir plus bas.



On verifie que le Uno est bien vu par le Raspberry Pi:


pi@raspberrypi ~ $ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 009: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)
pi@raspberrypi ~ $ 



L'installation

Avant de faire l'installation du logiciel, du compilateur, de l'environnement de développement pour l'Arduino, on s'assure que Raspbian est bien a jour en faisant un ap-get update (deux fois au cas ou):


Linux raspberrypi 3.2.27+ #160 PREEMPT Mon Sep 17 23:18:42 BST 2012 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

pi@raspberrypi ~ $ sudo apt-get update
Get:1 http://mirrordirector.raspbian.org wheezy InRelease [12.5 kB]
Get:2 http://archive.raspberrypi.org wheezy InRelease [7,665 B]
Get:3 http://mirrordirector.raspbian.org wheezy/main armhf Packages [7,376 kB]
Get:4 http://archive.raspberrypi.org wheezy/main armhf Packages [5,738 B]
Ign http://archive.raspberrypi.org wheezy/main Translation-en_GB              
Ign http://archive.raspberrypi.org wheezy/main Translation-en
Get:5 http://mirrordirector.raspbian.org wheezy/contrib armhf Packages [23.3 kB]
Get:6 http://mirrordirector.raspbian.org wheezy/non-free armhf Packages [46.4 kB]
Get:7 http://mirrordirector.raspbian.org wheezy/rpi armhf Packages [14 B]      
Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en_GB        
Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en           
Ign http://mirrordirector.raspbian.org wheezy/main Translation-en_GB           
Ign http://mirrordirector.raspbian.org wheezy/main Translation-en              
Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en_GB       
Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en          
Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en_GB            
Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en               
Fetched 7,471 kB in 40s (183 kB/s)                                             
Reading package lists... Done
pi@raspberrypi ~ $ sudo apt-get update
Hit http://archive.raspberrypi.org wheezy InRelease
Hit http://mirrordirector.raspbian.org wheezy InRelease
Hit http://archive.raspberrypi.org wheezy/main armhf Packages
Hit http://mirrordirector.raspbian.org wheezy/main armhf Packages
Hit http://mirrordirector.raspbian.org wheezy/contrib armhf Packages
Hit http://mirrordirector.raspbian.org wheezy/non-free armhf Packages
Hit http://mirrordirector.raspbian.org wheezy/rpi armhf Packages
Ign http://archive.raspberrypi.org wheezy/main Translation-en_GB
Ign http://archive.raspberrypi.org wheezy/main Translation-en
Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en_GB
Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en
Ign http://mirrordirector.raspbian.org wheezy/main Translation-en_GB
Ign http://mirrordirector.raspbian.org wheezy/main Translation-en
Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en_GB
Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en
Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en_GB
Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en
Reading package lists... Done
pi@raspberrypi ~ $ 


Je suis a jour, et pas besoin de faire de apt-get upgrade.

Maintenant on fait l'installation. C'est d'une simplicite choquante, apt-get install arduino!


pi@raspberrypi ~ $ sudo apt-get install arduino
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  arduino-core avr-libc avrdude binutils-avr ca-certificates-java default-jre
  default-jre-headless extra-xdg-menus gcc-avr icedtea-6-jre-cacao
  icedtea-netx icedtea-netx-common java-common libatk-wrapper-java
  libatk-wrapper-java-jni libftdi1 libjna-java libnspr4 libnss3 libnss3-1d
  librxtx-java openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib
  ttf-dejavu-extra tzdata-java
Suggested packages:
  arduino-mk avrdude-doc task-c-devel gcc-doc gcc-4.2 equivs libjna-java-doc
  icedtea-plugin libnss-mdns sun-java6-fonts fonts-ipafont-gothic
  fonts-ipafont-mincho ttf-wqy-microhei ttf-wqy-zenhei ttf-indic-fonts
Recommended packages:
  icedtea-6-jre-jamvm
The following NEW packages will be installed:
  arduino arduino-core avr-libc avrdude binutils-avr ca-certificates-java
  default-jre default-jre-headless extra-xdg-menus gcc-avr icedtea-6-jre-cacao
  icedtea-netx icedtea-netx-common java-common libatk-wrapper-java
  libatk-wrapper-java-jni libftdi1 libjna-java libnspr4 libnss3 libnss3-1d
  librxtx-java openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib
  ttf-dejavu-extra tzdata-java
0 upgraded, 27 newly installed, 0 to remove and 0 not upgraded.
Need to get 58.3 MB of archives.
After this operation, 173 MB of additional disk space will be used.
Do you want to continue [Y/n]? 
[et on y va... longue liste]


On nous suggere d'autres archives, on les installe au cas ou:


pi@raspberrypi ~ $ sudo apt-get install arduino-mk avrdude-doc equivs libjna-java-doc icedtea-plugin libnss-mdns fonts-ipafont-gothic fonts-ipafont-mincho ttf-wqy-microhei ttf-wqy-zenhei ttf-indic-fonts
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  autopoint avahi-daemon bind9-host debhelper fonts-beng fonts-beng-extra
  fonts-deva fonts-deva-extra fonts-gubbi fonts-gujr fonts-gujr-extra
  fonts-guru fonts-guru-extra fonts-indic fonts-knda fonts-knda-extra
  fonts-lohit-beng-assamese fonts-lohit-beng-bengali fonts-lohit-deva
  fonts-lohit-gujr fonts-lohit-guru fonts-lohit-knda fonts-lohit-mlym
  fonts-lohit-orya fonts-lohit-taml fonts-lohit-telu fonts-mlym fonts-nakula
  fonts-navilu fonts-orya fonts-orya-extra fonts-pagul fonts-sahadeva
  fonts-samyak-gujr fonts-samyak-taml fonts-smc fonts-taml fonts-telu
  fonts-telu-extra geoip-database gettext git git-man html2text
  icedtea-6-plugin intltool-debian libavahi-core7 libbind9-80
  libconfig-yaml-perl libcurl3-gnutls libdns81 liberror-perl libgeoip1
  libgettextpo0 libisc83 libisccc80 libisccfg82 liblwres80
  libmail-sendmail-perl libsys-hostname-long-perl libunistring0
  libyaml-libyaml-perl libyaml-perl perl-doc po-debconf rsync
Suggested packages:
  avahi-autoipd doc-base dh-make gettext-doc git-daemon-run
  git-daemon-sysvinit git-doc git-el git-arch git-cvs git-svn git-email
  git-gui gitk gitweb geoip-bin libyaml-shell-perl groff libmail-box-perl
The following NEW packages will be installed:
  arduino-mk autopoint avahi-daemon avrdude-doc bind9-host debhelper equivs
  fonts-beng fonts-beng-extra fonts-deva fonts-deva-extra fonts-gubbi
  fonts-gujr fonts-gujr-extra fonts-guru fonts-guru-extra fonts-indic
  fonts-ipafont-gothic fonts-ipafont-mincho fonts-knda fonts-knda-extra
  fonts-lohit-beng-assamese fonts-lohit-beng-bengali fonts-lohit-deva
  fonts-lohit-gujr fonts-lohit-guru fonts-lohit-knda fonts-lohit-mlym
  fonts-lohit-orya fonts-lohit-taml fonts-lohit-telu fonts-mlym fonts-nakula
  fonts-navilu fonts-orya fonts-orya-extra fonts-pagul fonts-sahadeva
  fonts-samyak-gujr fonts-samyak-taml fonts-smc fonts-taml fonts-telu
  fonts-telu-extra geoip-database gettext git git-man html2text
  icedtea-6-plugin icedtea-plugin intltool-debian libavahi-core7 libbind9-80
  libconfig-yaml-perl libcurl3-gnutls libdns81 liberror-perl libgeoip1
  libgettextpo0 libisc83 libisccc80 libisccfg82 libjna-java-doc liblwres80
  libmail-sendmail-perl libnss-mdns libsys-hostname-long-perl libunistring0
  libyaml-libyaml-perl libyaml-perl perl-doc po-debconf rsync ttf-indic-fonts
  ttf-wqy-microhei ttf-wqy-zenhei
0 upgraded, 77 newly installed, 0 to remove and 43 not upgraded.
Need to get 49.1 MB of archives.
After this operation, 116 MB of additional disk space will be used.
Do you want to continue [Y/n]? 
[et on y va... une autre longue liste]




On y va


Une fois installé on peut voir sous electronics, le Arduino IDE dans le menu LXDE:


On peut aussi lancer par la ligne de commande l'environnement en tapant:

arduino

D'ailleurs, si on accède a notre Raspberry Pi par l'entremise d'un PC et de ssh -X, l'IDE s'affiche alors sur notre PC, mais roule sur le Raspberry Pi. Une fois que l'on a écrit du code Wiring (du C avec des fonctions spéciales genre analogWrite, digitalWrite etc), on clique sur le bouton avec la coche pour compiler.

Pour transférer le programme executable sur l'Arduino, on clique sur la flèche qui pointe vers la droite. Les relais vont commencer a travailler du moment que le programme est transféré.



Finalement, l'avantage d'avoir l'alimentation sur le Arduino, c'est que l'on peut retirer le Raspberry Pi et notre programme continue de rouler sur l'Arduino, activant les relais sans problemes.


Finalement, il ne s'agit que d'un exemple bien simple. On peut aussi controler l'Arduino avec Firmata (un protocole de communication) et le module Python PyFirmata.

Aussi, de façon générale, je contrôle les relais directement du Raspberry Pi, mais ça, c'est pour une autre fois.

Tuesday, October 2, 2012

ZFS file system on Raspberry Pi

FISH


I do a good bit of hardware integration with the web, with manufacturing equipment, with embedded systems and with big data set, or that can sustain multiple failures. Not necessarily all at once, but typically, people expect FISH from me :)

FISH is Fully Integrated Software and Hardware (btw, as a side note, the internal project at Sun to create appliances based on ZFS was known as FISHWorks). The Raspberry Pi is a cool piece of hardware, but I typically need stuff that is only (or mostly) found on Solaris and derived OSes, such as ZFS. I've been using ZFS for many years now, since the first public release on Solaris Nevada. ZFS scales and give you data integrity. And it can run on the largest systems known to man.

It scales


For example, I'm listening right now to ZFS Day's live video stream and hearing a talk about ZFS on the Sequoia supercomputer, which is the fastest supercomputer out there. They are using it as a native port, not using FUSE.

What is ZFS? 


Wikipedia: "ZFS is a combined file system and logical volume manager designed by Sun Microsystems. The features of ZFS include data integrity verification against data corruption modes, support for high storage capacities, integration of the concepts of filesystem and volume management, snapshots and copy-on-write clones, continuous integrity checking and automatic repair, RAID-Z and native NFSv4 ACLs. ZFS is implemented as open-source software, licensed under the Common Development and Distribution License (CDDL)."

From Supercomputers to $35 computers


So, ZFS scales at the highest level obviously. Well, it also scales down: I've been using a bit ZFS on the Raspberry Pi using FUSE, until I can get a Solaris derived OS ( such as illumos, smartos, openindiana, opensolaris etc) on the Raspberry Pi. That way, at least I have ZFS. Still missing zones, smf and dtrace, but it is a start.

Now just a reminder, the Pi only has 256MB total ram, and a BCM arm processor. So first thing first, we need to give as much ram to the OS as possible, and reduce the video buffer size:



I'm using a 240MB split on that Raspberry Pi since it is running only in text mode at the console, and I remote to it using ssh -X.


If you use the composite out you might want to use the 224MB split and definitely 192 or 128 using HDMI, but then at that point, you are chocking ZFS. That's 128 for OS and ZFS and whatever apps you are running...

Fully loaded


Altough Raspbian comes with a good amount of stuff preloaded, it was not intended to be used with FUSE out of the box, and ZFS was probably never on the radar screen of anybody. So let's start with adding the FUSE stuff and the libraries and tools we will need to build ZFS. This is the shortlist:


fdion@raspberrypi ~/zfs $ sudo apt-get install fuse-utils libfuse-dev libfuse2
fdion@raspberrypi ~/zfs $ sudo apt-get install libaio-dev libattr1-dev attr
fdion@raspberrypi ~/zfs $ sudo apt-get install git scons



If you build it...


So we have the prerequisites. Let's get the code, compile it and install the tools:


fdion@raspberrypi ~ $ mkdir zfs
fdion@raspberrypi ~ $ cd zfs
fdion@raspberrypi ~/zfs $ git clone https://bitbucket.org/cli/zfs-fuse-arm.git
fdion@raspberrypi ~/zfs $ cd zfs-fuse-arm/
fdion@raspberrypi ~/zfs/zfs-fuse-arm $ cd src
fdion@raspberrypi ~/zfs/zfs-fuse-arm/src $ scons
[a lot of stuff will scroll by]
fdion@raspberrypi ~/zfs/zfs-fuse-arm/src $ sudo scons install
[again, more stuff will scroll by]

Wow, it compiled (scons). And installed (sudo scons install). It's a good thing we are using the zfs-fuse-arm version, because the mainline wont go very far on the compile.

A demonstration, if you please? 


Well of course! Let's start the zfs-fuse daemon and create two virtual disks. I'm creating two 100M disks here using dd/ (this is on a slow SD card, rated 10MB/s). You could also use an actual /dev (like a pair of USB keys):


fdion@raspberrypi ~/zfs/zfs-fuse-arm/src/zfs-fuse $ sudo sh run.sh &

fdion@raspberrypi ~/zfs/zfs-fuse-arm/src/zfs-fuse $ cd
fdion@raspberrypi ~ $ cd zfs
fdion@raspberrypi ~/zfs $ mkdir test
fdion@raspberrypi ~/zfs $ cd test
fdion@raspberrypi ~/zfs/test $ dd if=/dev/zero of=fakedisk1 bs=1024k count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 10.2747 s, 10.2 MB/s
fdion@raspberrypi ~/zfs/test $ dd if=/dev/zero of=fakedisk2 bs=1024k count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 10.7517 s, 9.8 MB/s

Up to now we haven't done anything with ZFS per say. And basically to mirror two drives in ZFS and create a new storage out of that, all we have to do:


fdion@raspberrypi ~/zfs/test $ sudo zpool create mymirror mirror /home/fdion/zfs/test/fakedisk1 /home/fdion/zfs/test/fakedisk2


Now let's create a filesystem on that new zpool device, and mount it to a local folder in my home directory, change permissions so I can write to it and finally copy some files from /etc to my new filesystem:


fdion@raspberrypi ~/zfs/test $ cd
fdion@raspberrypi ~ $ mkdir myfilesystem
fdion@raspberrypi ~ $ sudo zfs create mymirror/myfilesystem -o mountpoint=/home/fdion/myfilesystem
fdion@raspberrypi ~ $ sudo chown fdion:pi myfilesystem/
fdion@raspberrypi ~/myfilesystem $ cp /etc/*.conf .
cp: cannot open `/etc/fuse.conf' for reading: Permission denied
fdion@raspberrypi ~/myfilesystem $ ls
adduser.conf          gssapi_mech.conf  libaudit.conf   pnm2ppa.conf
asound.conf           hdparm.conf       logrotate.conf  resolv.conf
ca-certificates.conf  host.conf         mke2fs.conf     rsyslog.conf
colord.conf           idmapd.conf       mtools.conf     sensors3.conf
debconf.conf          insserv.conf      nsswitch.conf   sysctl.conf
deluser.conf          ld.so.conf        ntp.conf        ts.conf
gai.conf              libao.conf        pam.conf        ucf.conf
fdion@raspberrypi ~/myfilesystem $ sudo zfs list
NAME                    USED  AVAIL  REFER  MOUNTPOINT
mymirror                191K  63.3M    22K  /mymirror
mymirror/myfilesystem  89.5K  63.3M  89.5K  /home/fdion/myfilesystem
fdion@raspberrypi ~/myfilesystem $ sudo zpool list
NAME       SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
mymirror  95.5M   196K  95.3M     0%  1.00x  ONLINE  -
fdion@raspberrypi ~/myfilesystem $ 




How cool is that? I now have a mirrored backup of my .conf files. Well, not quite. We are using fake disks, so if the SD card dies I loose all.

So next time we'll demo with actual USB drives.

Friday, September 21, 2012

Editor de codigo Python (texto)

Muchas veces, debo hacer cambios, o escribir por completo un script (secuencia de comandos) Python a través de una conexión ssh. Sin X forwarding tampoco, y por eso no puedo utilizar un editor grafico.

Hay nano y vi en la distribución Raspbian Wheezy, pero, hay algo mejor: vim. En la mayoría de las distribuciones Linux y en OpenIndiana, vi es en realidad vim, pero en Raspbian, vi es vi. Vamos a ajustar eso:

fdion@raspberrypi ~ $ sudo apt-get install vim
Y tambien hay que anadir a .vimrc (en /home/user):

syntax on
filetype indent plugin on
set modeline

fdion@raspberrypi ~ $ pwd
/home/fdion
fdion@raspberrypi ~ $ ls .vimrc
.vimrc
Muy bien, ahora es mas facil a leer el codigo Python en color:


vi file.py




Hay tambien que anadir una linea con instrucciones para vim:


La primera linea es siempre la "shebang":

#!/usr/bin/env python


Despues, una docstring (descripcion) del fichero entre """ y """. La septima linea (en nuestro ejemplo) es para vim:

# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4


Voy a anadir otra linea tambien, en espanol, frances y portugués, a causa de los acentos debemos poner el codigo:

# -*- coding: utf-8 -*-
 

Friday, September 14, 2012

Sidekick 2

Continuing on using the raspberry pi as your desktop's sidekick, we will focus today on making it easier to work with, better integrated, when your desktop is Unix (Solaris, OpenIndiana), Linux, Mac OS/X or even Windows (except you wont be able to use ssh-keygen or scp - instead check the section I Got a PC? toward the end of the post).

Automating login

First thing first, we need to create a new user on the Raspberry Pi. Although the user pi is pretty cool, you dont want to have to specify the user in all the commands you will do, so we'll match it to the username on the desktop.

Let's say your username is user on your desktop (of course, if you want to have a username billybob, then replace user with billybob in the below code). You will need to connect as the pi user, then set up a new user:


 ssh pi@raspberrypi  
 (enter your pi user password)  
 pi@raspberrypi ~ $ sudo useradd -d /home/user -s /bin/bash user   
 pi@raspberrypi ~ $ sudo mkdir /home/user  
 pi@raspberrypi ~ $ sudo chown user:pi /home/user  
 pi@raspberrypi ~ $ sudo passwd user  
 pi@raspberrypi ~ $ Enter new UNIX password:  (type password)
 pi@raspberrypi ~ $ Retype new UNIX password:  (type it again)
 pi@raspberrypi ~ $ passwd: password updated successfully  
 pi@raspberrypi ~ $ sudo cp .bashrc ../user
 pi@raspberrypi ~ $ sudo cp .profile ../user

The last item we have to do is to edit the /etc/sudoers file and add our user to it ([esc] means hit the escape key):

 pi@raspberrypi ~ $ sudo vi /etc/sudoers  
 (add the following line after going to last line and typing o)  
 user ALL=(ALL) NOPASSWD: ALL  
 [esc] :wq!
 pi@raspberrypi ~ $ exit

BTW, for most people, there is too much detail (such as how to add a line in vi), but keeping in mind that there are some people in schools reading this and they just starting playing with this, I think it is well justified).

 We now go back to our desktop and test that we can login as the user (no need to specify user@raspberrypi, just raspberrypi since the default is to user the desktop current user):

 user@desktop ~ $ ssh raspberrypi  
 (enter password)  
 user@raspberrypi ~ $ mkdir .ssh  
 user@raspberrypi ~ $ exit  

Now, we will generate an RSA private and public key pair. We will then copy the public key to the RPi as authorized_keys2 under the .ssh folder:

 user@desktop ~ $ ssh-keygen -t rsa  
 (enter to accept the defaults)  
 user@desktop ~ $ cd .ssh  
 user@desktop ~ $ scp id_rsa.pub raspberrypi:.ssh/authorized_keys2  
 (enter password)  

We will login once more on the RPi to change access:

 user@desktop ~ $ ssh raspberrypi  
 (enter password)  
 user@raspberrypi ~ $ cd .ssh  
 user@raspberrypi ~ $ chmod go-r authorized_keys2  
 user@raspberrypi ~ $ exit  

At last, we can now copy files using scp or login on our RPi without entering a password:

 user@desktop ~ $ ssh raspberrypi  
 user@raspberrypi ~ $  

Yeah!

SCP tasks

Getting a file

To get a file from the RPi, onto the desktop:

The file is in the /home/user directory:
user@desktop ~ $ scp raspberry:file.txt .
 
The file is in /home/user/directory:
user@desktop ~ $ scp raspberry:directory/file.txt .
 
The file is in /home/user/directory/subdirectory:
user@desktop ~ $ scp raspberry:/home/user/directory/subdirectory/file .

Putting a file

To get a file from the RPi, onto the desktop:

The file is in the /home/user directory:
user@desktop ~ $ scp raspberry:file.txt .
 
The file is in /home/user/directory:
user@desktop ~ $ scp raspberry:directory/file.txt .
 
The file is in /home/user/directory/subdirectory:
user@desktop ~ $ scp raspberry:/home/user/directory/subdirectory/file .

Action on a directory

To get or put a directory, simply use the -r flag:

user@desktop ~ $ scp -r mydir raspberry:
 
This will copy recursively mydir onto the server named raspberry, into the default home directory. There is a lot more flexibility to scp, so read up on it:

user@desktop ~ $ man scp

GUI access

I use OpenIndiana as a desktop, most of the time, and that OS, and most Linux versions, has a tool to connect to a server using various protocols and provide a GUI. In the case of OpenIndiana, it is the gnome tool that can be found in the menu as item "connect to server":


This will then open a Nautilus file browser:

Other Options

Another option under unix/linux to access files remotely is through sshfs, a FUSE module. It allows to mount an ssh (sftp) remote system as a local filesystem. If you need this, you are probably already know how to use it, so I wont get into details.

I got a mac?

There is no GUI option directly, Basically, using the technique above with FUSE, I've done it on my Mac using FUSE at http://osxfuse.github.com/, then I downloaded Macfusion.


If anybody wants a more detailed instruction, leave a comment. I dont want to spend too much time on this if no reader is using a raspberry pi as a sidekick to a Mac.

I got a PC?

To automatically login without password, you will need putty (see the previous blog entry on this) and also puttygen. But at the end of the day, why bother? 

The OS doesn't leverage this. Instead, get a GUI interface like Winscp to copy files back and forth.


I use winscp all the time with Windows 7, and you can save configurations, including passwords, so this is fairly painless.