Thursday 29 June 2017

Network and share your keyboard and mouse

Borrow a mouse and keyboard from another PC, usingonly your Raspberry Pi and Synergy 

Install Synergy Synergy is available from the Raspbian repositories. We can install it by using the following:
$ sudo apt-get update$ sudo apt-get install synergyThis will go through the basic installation process as normal and Synergy will be put in the Accessories folder.

What you’ll need
  • Latest Raspbian Image
  • Synergy
  • Host computer
 Encryption and passwords Here, you can set up whether or not the connection is encrypted. This is useful for stopping key loggers from being able to snoop on your information, or random clients from connecting and hijacking your mouse. Provide a password and then click Finish.
Server naming Once the process has finished, go to Configure Server. Your host computer will be put virtually in the centre of your array of displays and you can drag and drop it around, along with
any connected screens. Double-click on the server to change its name, making it easier to remember and find. Add a new screen and call it pi.

any connected screens. Double-click on the server to change its name, making it easier to remember and find. Add a new screen and call it pi.any connected screens. Double-click on the server to change its name, making it easier to remember and find. Add a new screen and call it pi.
Starting and connecting Once you’re happy with the setup, click Start to be able to accept client connections. To connect from a Raspberry Pi, enter the following:$ synergyc --name pi [IP Address of host] It will be recognized as ‘pi’ on the host system.
Autostart Synergy To make sure it starts every time you turn on the Pi, we need to create an LXDE auto-start file by using the following:$ sudo mkdir -p ~/.config/lxsession/LXDE
$ sudo touch ~/.config/lxsession/LXDE/autostart
$ sudo nano ~/.config/lxsession/LXDE/autostart 
And then add the following to autostart: ~/.startsynergy.sh
 Start fi Open and populate the startsynergy fi le le with:$ sudo nano ~/.startsynergy.sh#!/bin/bash killall synergycsleep 1synergyc --name pi [IP address of host]exit 0
Permissions Finally, to finish it off you’ll need to run: sudo chmod 777 ~/.start synergy.shThis will auto-start, and hopefully auto-connect, Synergy whenever you turn it on. The Raspbian client is a little old, so if you get a problem you may need to compile the latest version from source.
Pi server Setting up the Raspberry Pi as a server is a little more involved and uses the synergys command. It allows you to listen for clients on specific addresses. You then need to create a separate configuration file to arrange the displays – however, you can load one from a different computer and edit it.  

Start up Synergy on the host computer and choose the ‘Server’ option for the moment. We’ll cover how to use it as a client later, and how to use the Raspberry Pi as a server for the mouse and keyboard.

Saturday 17 June 2017

Tor Web-Station


Stay private online by routing all your web traffic through Tor  on your Raspberry Pi


In a much more privacy focused world, being able to browse securely online is an important freedom for many people. 
With the use of Tor and a few tweaks to the Raspberry Pi, you can make sure all your internet traffic is kept 
private. First of all, you’ll need to make sure to install Tor from the repos. Open up the LXTerminal and 
simply type:

$ sudo apt-get install tor

Once that’s done, edit the torrc file by using sudo nano /etc/tor/torrc and add this to the top of the file:

VirtualAddrNetworkIPv4 10.192.0.0/10
AutomapHostsOnResolve 1
TransPort 9040
DNSPort 53




Save this and then open the next file with sudo nano /etc/resolv.conf file and modify it:
nameserver 127.0.0.1

Finally, you need to change the iptables ruleset, but beforeyou do this, use top to confirm the uid of Tor and make a note of it. Now open up a new file with nano /etc/init.d/iptables and    enter the code found at:content/uploads/2014/08/tor.zip. Now save it and enter:

$ chmod 755 /etc/init.d/iptables
$ update-rc.d iptables defaults 12

Put ’em together

A secure wireless connectioncan be created using the RaspberryPi by looking at the OnionPi Project from Adafruit: learn.adafruit.com/onion-pi/overviewThis creates a Wireless access Point connected To the internet that Anonymises all web traffic by directing it through the Tor network. This means al l your Home computers and Smart devices can be Connected to Tor and Not just theRaspberry Pi itself. 

Host your own website on Raspberry Pi

Don’t pay for web hosting. Configure your Raspberry Pi to act as a web server and host modest website


What you’ll need
Latest Raspbian image
raspberrypi.org/downloads
Internet connection
External hard drive (optional)
USB flash (optional) 
Ethernet cable for reliability

Need a lightweight, low-cost web server? Your RaspberryPi is all you need! Whether you’re planning on hosting a static homepage (or one with minimal database use) or need an easy home for development websites, setting up your Raspberry Pi as awebserverissurprisinglyeasy. Ideal as an always-on device thanks to its low-power requirements, the Raspberry Pi can sit beside your router and serve a basic website to visitors, allowing you to put hosting fees to better use. You might wish to serve pages for some of your Pi projects,orevenapersonalpagetohostphotosoryourCV. If you’re planning on using it as a web-facing device, your Pi will need to be set up with a static IP address. You’ll also need to ensure your internet provider offers static IP addresses for their users.OftenapriceischargedforleasingastaticIP,butthereare servicesyoucanuse(suchasnoip.com).ability

Connect your Ethernet cable
For this project it makes more sense to use an Ethernet cable. You may need your existing USB ports to attach flash drives or an external HDD to serve your web page. With Ethernet you will need to rule out any wireless issues that are causing interruptionsforyourvisitors.

Get Raspbian updates and Apache
Asever,begin by checking for Raspbian updates: sudo apt-get update You’ll then need to install Apache and PHP: sudo apt-get install apache2 php5 libapache2-mod-php5 Finally, restart Apache: sudo service apache2 restart
Your RaspberryPi is now ready to be used as a webserver.

You can upload files to /vav/www

Check your Pi web server
With Apache installed, open the browser on another computer on youra network and enter your Pi’s IP address to view the Apache confirmation page. As things stand right now, all you will be able to view is the Apache index.php page. To add your own HTML and PHP pages, you will need FTP.
Install FTP for uploading files
Create a www folder, then install the following vsftpd FTP server software:
sudo chown -R pi /var/www
sudo apt-get install vsftpd
You’ll need to make some changes to Very Secure FTP Daemon, so open it in nano. First, switch:
anonymous_enable=YES
…to…
anonymous_enable=No
Next, uncomment the following by removing the # symbols:
#local_enable=YES
#write_enable=YES

Restart the FTP Server
Complete configuration of the FTP software by adding a command to the end of the file which will display server files starting with “.” such as .htaccess:
force_dot_files=YES
Save and exit nano (Ctrl+X) and restart FTP:
sudo service vsftpd restart
Using the default Raspbian credentials you can upload files to /var/www.

Make Pi a LAMP server
By adding MySQL into the mix you can use the Pi to host a database-driven website or even WordPress (although this is
bestlimitedtousingthedeviceasadevelopmentserver).
sudo apt-get install mysql-server mysql-client
php5-mysql
TheLAMPbundleisusefulofcourse,butforthebestresultsyour siteshouldremainstreamlined.
Get your site online
Can’t afford a static IP for your router? A great solution is available with the free service from www.noip.com. This enables you to point a hostname at your computer by using a client application that will remain in contact with the No-IP servers.
Install No-IP
Make a new directory and switch it to:
mkdir /home/pi/noip
cd /home/pi/noip
Download No-IP on your Pi with:
wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
Extract:
tar vzxf noip-duc-linux.tar.gz
Next, navigate to the directory and use sudo make and sudo make install, following any instructions. Finish by running: sudo /usr/local/bin/noip2

Change your password for security
Before using your Pi as a live web server, it’s a good idea to change the default password to something more imaginative than ‘raspberry’. In the command line, enter passwd and then follow the prompts to add your new, secure password. You’re doing this step because you obviously would not want your Pi web server to get hacked!