Now check if SSH-access is working.

On the PC in the search field of Windows the taskbar type: cmd. This opens a command prompt.
(You can also press Windows key + R and then type cmd.)
Type in the command prompt: ssh pi@raspberrypi. You will be asked to confirm the authenticity of the Raspberry pi. After you have done this you will get access to the Raspberry pi.
After entering the password you have access to the Terminal on the Raspberry Pi.
(if not: Did you activate the OpenSSHClient feature of Windows? Are you sure that the SSH interface on the Raspberry Pi is open?)

Start WinSCP (https://winscp.net/eng/download.php) on your PC,
• Select New Site.
• Target computer: raspberrypi (port remains 22)
• Username: pi (with associated password)
• Open Advanced
• Select SFTP in the menu
• For SFTP-server, enter: sudo su -c /usr/lib/sftp-server
(this ensures that you log in as a sudoer, so you can execute any command)
• Save
Then choose Log in.
If all goes well, you are logged in as a sudoer on the Raspberry Pi and you can execute all commands.
If all goes well WinSCP now opens with /home/pi on the right part of the screen.

We will now change the SSH/SFTP access to work with a private/public key pair instead of user + password.
Run the following commands on the Raspberry pi:
mkdir ~/.ssh
chmod 700 ~/.ssh
exit (you are now disconnect the raspberrypi)
At the Windows command prompt type the following commands:
mkdir .ssh
cd .ssh
ssh-keygen
Generate keys without passphrase; the id_rsa and id_rsa.pub files are now created in the .ssh folder on your PC..

Then continue with WinSCP

At the Windows command prompt you now reconnect to the Raspberrypi:
ssh pi@raspberrypi. If all goes well you will now have access without having to enter a password.

We will now further configure WinSCP.

Congratulations: You now have the right access to the Raspberry pi.

N.B. I work in the command window of the Raspberry pi standard as root user so that I do not have to type ‘sudo’ for every command. Switching to root is done with a command: sudo -i
I open the command window from WinSCP (Commands => Open in PuTTY).
I usually use WinSCP Notepad ++ as a file editor instead of, for example, nano.

Give the Raspberry pi a fixed IP address in your local network. Type the following command in the terminal on the Raspberry pi: ifconfig eth0.
After the ‘ether’ heading, you will find the MAC address of the ethernet connection of the Raspberry pi.
Connect this Mac address in your router to an IP address in your network.


Previous pageNext page