Skip to content
Nosce Te Ipsum
  • Home
  • About me
  • My COETAIL Blogs
    • Course 1
    • Course 2
    • Course 3
    • Course 4
  • Testimonials
    • Professional
    • Personal
Site Search
(c) Raspberry Pi General Unix

Starting with Raspberry Pi

  • November 7, 2018November 7, 2018
  • by Muhammad
Share on Facebook
Facebook
Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
Pin on Pinterest
Pinterest
Share on Reddit
Reddit
Email this to someone
email
Share on StumbleUpon
StumbleUpon
Digg this
Digg

If you’ve got yourself a ‘Raspberry Pi’ and you want to turn it into a personal server like I did for my first Raspberry Pi, I recommend that you run the stock OS ‘Raspbian’ which is based on ‘Debian Linux’. You can download it from https://www.raspberrypi.org/downloads/. If you want the easy way, use NOOBS but if you are a geek, I recommend that you use the Raspbian -> Lite image. You can download it as a zip file and use Etcher to flash it to the SD card you have for your Raspberry Pi.

It is ideal to get a micro SD card of more than 8GB to provide yourself plenty of room for upgrades and app installs. The lite version takes a few MB only for start, but you may want to keep some of your data on it e.g. when running a non-multimedia website and may wish to rotate logs and keep old ones for a long duration.

Downloading and flashing the OS on SD card is easy enough. Then:

  • if you are running the server in ‘headless’ mode you will need to access via ssh and ssh is disabled on recent versions of Raspbian. You should have that micro SD card still in the computer you used for flashing the Raspbian on it. After flashing you may see one or two partitions mounted from the micro SD card, depending on your computer OS. Look for the one called ‘boot’ and simply create an empty file with the name ‘ssh’ without any file extension. When Raspbian boots for the first time, it looks for this file. If it exists, Raspbian will enable ssh. If it doesn’t, there will be no ssh and you need a monitor and a keyboard attached to the Raspberry Pi in order to proceed.
  • now pop the micro SD card into the slot on the Raspberry Pi and connect the micro USB power cable.
  • there is no ‘root’ user in Raspbian and you are to log in with user 'pi' and default password 'raspberry' and then use sudo for all your interaction with Raspbian.
  • The first thing you should run, after it boots is ‘raspi-config’ which has a list of options to choose from and you will want to set some of those, including change of password, hostname etc.
  • I usually run sudo apt-get update and sudo apt-get upgrade after booting my Linux OS for the first time – of course after having it connected to a working network/Internet connection.
  • You are all set to install what you wish on it.

One app which I highly recommend you to install and configure is fail2ban. This will prevent unauthorised access to your server for several applications including ssh and allows you to configure how it deals with those attempts.

You can install it with following instructions

sudo apt-get install fail2ban
cd /etc/fail2ban/
cp fail2ban.conf fail2ban.local
cp jail.conf jail.local

We make copies with extension .local for these two files and make our changes in these .local files because any update to the app itself will always replace the .conf files with updated versions and you do not want to loose your configs.

sudo cp /etc/fail2ban/fail2ban.conf fail2ban.local
sudo cp /etc/fail2ban/jail.conf jail.local

In the fail2ban.local you can configure log locations for example. It is heavily remarked so should not be a problem for you to go through and know what you wish to change and how to change it. For jail.local you should at least pay attention to the following:

sudo vim /etc/fail2ban/jail.con

look for following snippets. I am copying what I changed to for mine. You need to replace IP address/range with yours.


[DEFAULTS]
ignoreip = 127.0.0.1 192.168.0.0/24
bantime = 86400
maxretry = 3
.
.
destemail = 'your email address here'
.
.
[sshd]
enabled = true

and I also changed the lines for the email address it should send mail to.

Share on Facebook
Facebook
Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
Pin on Pinterest
Pinterest
Share on Reddit
Reddit
Email this to someone
email
Share on StumbleUpon
StumbleUpon
Digg this
Digg
Technology, Art, Design and Leadership
Setting up L2TP/IPSEC server using PSK on Raspberry Pi using Strongswan
Muhammad
fail2ban pi raspberry raspberry pi

Related articles

Raspberry PI as temperature and…
Dynamic DNS client setup for…
Install Nginx, MySQL and PHP…
Autostart a terminal app on…
Attaching an external storage with…
Setting up L2TP/IPSEC server using…
Using GeoIP database to identify…
Designing Technology Infrastructure for Transformational…
The sad state of human…
Installing RD9700 chipset based USB…

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow Me!

Follow Me On TwitterFollow Me On LinkedInFollow Me On PinterestFollow Me On About.meFollow Me On Wordpress
May 2025
M T W T F S S
« Oct    
 1234
567891011
12131415161718
19202122232425
262728293031  

2009 2010 2011 Amelie apache beijing birthday clearos crèpes debian december 2009 dubai email february firewall guide holidays ill install internet kuala lumpur linux list mac maheen mobile october 2009 outlook Pakistan raspberry raspberry pi router search Sharepoint smtp snow spring ubuntu unix VLAN VPN windows 7 winter xian Zimbra

WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.

Categories

Licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Theme by Colorlib Powered by WordPress
  • Home
  • About me
  • My COETAIL Blogs
  • Testimonials