PLC. Hackers Manual 14ed 2023
PLC. Hackers Manual 14ed 2023
MANUAL
•2023
FULL OF
expert
TIPS&
advice
AND GUIDES
Welcome to the 2023 edition of the Hacker's Manual! You hold in your hands
148 pages of Linux hacking tutorials, guides and features from the experts at
Linux Format magazine - the home of open source software. In this edition
we've gone in hard for security. You'll find guides to securing servers, getting
a grounding in hacking, using security tools such as Kali and Fedora Security
Lab, alongside solid features explaining how to protect your privacy online
using established tools like Tails. But we shouldn't live in fear! Hacking is
monumental fun. Never mind setting up and playing with Linux, we take a
look at hacking tablets, media servers, virtual machines, cloud servers,
multi-booting with Grub and much more. If you're a little timid when it comes
to the Terminal we even have a meaty reference section at the back.
So dive in and enjoy!
HACKER’S
MANUAL
2023
Future PLC Quay House, The Ambury. Bath. BAI 1UA
Editorial
Designer Steve Dacombe
Compiled by Aiden Dalby & Adam Markiewicz
Senior Art Editor Andy Downes
Head of Art & Design Greg Whitaker
Editorial Director Jon White
Photography
All copyrightsand trademarks are recognised and respected
Advertising
Media packs are available on request
Commercial Director Clare Dove
International
Head of Print Licensing Rachel Shaw
licensing@futurenet.com
www.futurecontenthub.com
Circulation
Head of Newstrade Tim Mathers
Production
Head of Production Mark Constance
Production Project Manager Matthew Eglinton
Advertising Production Manager Joanne Crosby
Digital Editions Controller Jason Hudson
Production Managers Keely Miller, Nola Cokely,
Vivienne Calvert, Fran Twentyman
Printed in the UK
All contents © 2023 Future Publishing Limited or published under licence. All rights reserved.
No part of this magazine may be used, stored, transmitted or reproduced in any way without
the prior written permission of the publisher. Future Publishing Limited (company number
2008885) is registered in England and Wales. Registered office: Quay House. The Ambury.
Bath BAI 1UA. All information contained in this publication is for information only and is. as far
as we are aware, correct at the time of going to press. Future cannot accept any responsibility
for errors or inaccuracies in such information. You are advised to contact manufacturers and
retailers directly with regard to the price of products^ervices referred to in this publication. Apps
and websites mentioned in this publication are not under our control. We are not responsible for
their contents or any other changes or updates to them. This magazine is fully independent
and not affiliated in any way with the companies mentioned herein.
FUTURE Connectors.
Creators.
Experience
Makers.
HACKER’S
MANUAL
2023
Distros Security
The distro is the core of Linux, so make The best defence is a good offence, but
sure you get the right one. also a good defence.
72 Key management
Learn how to create a good GnuPG key and
keep it safe from online thieves.
Software Hacking
Discover the most powerful Linux Take your Linux skills to
software and get using it. the next level and beyond.
The terminal
Feel like a 1337 hacker and get to grips
with the powerful terminal.
C R ED IT: @simonjbutcher
Canonical is pushing ahead with its Snap initiative.
There’s only one problem. At time of writing, it hasn’t
been released. But that’s okay, because it will be by the
time you read this. And if we’re lucky there we won't
have missed any last-minute additions or surprises.
We’ve been testing the daily Jammy Jellyfish images for
a couple of months prior to the official release.
be aware that there’s light and dark versions of the Yaru > The official
Minor niggles, begone! theme, and you'll suspect (rightly) that these have been background
And we've seen quite a bit of change in that time, further tweaked. To be frank, if you’ve been using is over the
page, but these
particularly as parts of the recently released Gnome 42 Ubuntu 21.10, then there’s not anything ground
Al-generated
start to find their way in. Indeed, as we write this were still breaking in 22.04. But that doesn't mean you shouldn’t
jellyfish by
about a week away from launch day, but since both the upgrade. You should, because if nothing else your
Simon Butcher
Feature and Ul Freeze have passed we don't expect any interim release is about to be EOLd. Oh, and if you're of
are something
drastic changes. We do rather hope some minor niggles the ilk that gets excited by phrases like 'modern design else.
(such as stuttering and occasional crashes trends', then check out the new logo. It's similar to the
while dragging windows between monitors) get sorted old Circle of Friends logo, but on a web3-friendly (stop
out, though. baiting sensible readers! - Ed) rectangular background.
If you've used either of the interim releases (21.04 or If you just want to see what Ubuntu is like, there's no
21.10) since the lasts LTS then you'll be aware that now need to install it at all. Just follow our handy three-step
Ubuntu uses Wayland and (maybe) remember that guide to downloading, writing and booting an Ubuntu
Active Directory can be set up from the installer. You'll USB stick, or DVD if you must.
Choose an Image
0 Select the .iso or .img that you want to flash. You can also plug
your USB drives in now.
Choose image
ubuntu-22.04 -beta-desktop-amd64.iso
3.2 GiB
Hash: None
Escape Windows
Whether you’re a complete novice or Windows has driven
you to seek out other operating systems, Ubuntu can help.
indows 11 has been rolled out through the cautions, and a little inconvenient, but it’s the only way to
Customise Ubuntu
Discover new software. Change settings. Install a new desktop (or three).
buntu (and most other desktop Linux flavours) never heard of. You will, however, find the official Spotify
:❖ & » b O « W ®
★ □ ® ©
£ Enabled
f>o
Firefox Multi-Account Containers C C ...
Multi-Account Containers helps you keep all the parts of yo...
uBlock Origin o©
> Installing the whole Kubuntu desktop package makes for a menu > An ad-blocker and Mozilla’s container programs are
that, unsurprisingly, is rich in items that begin with K. essential for the modern Web. And switching the default
search to DuckDuckGo.
that dogged Ubuntu Gnome’s allowed ESM on up to three machines for free, so if you
want to keep the Xerus alive you can now do so in a safe
performance for so long are well and (semi) supported manner.
We were feeling nostalgic, so we fired up Ubuntu 16.04
and truly gone.” on our XPS. This hadn’t been booted for some time, and
had problems seeing our new-fangled USB-C dock (or the
One change mulled for 22.04 but which in the end network cable plugged therein). But once we’d updated it,
never made it is the replacement of PulseAudio with enrolled the machine in Ubuntu Advantage and updated
PipeWire. The latter is a whole new multimedia framework again everything worked more or less fine. Don’t let
which, as it happens, enables desktop sharing and screen anyone tell you nostalgia is not a good reason for running
recording on Wayland. Programs may still depend on old software. Especially when you're entitled to run three
PipeWire (particularly web browsers), but venerable instances for your own pleasure. If you were looking for
PulseAudio remains the default sound server. If you want actual phone and ticket support, then this starts at $150/
to change this (for example, if you are having difficulty year for a single desktop installation or $750/year for a
with Bluetooth headsets), you can install the PipeWire server. It's not really intended to help beginners get their
session with printers or Wi-Fi working. Ask nicely on https://
ubuntuforums.org or https://askubuntu.com for
that sort of support.
Booting back into the new release was much
quicker and smoother by comparison, which to be
honest you'd expect after six years of Ul
development. This release might not have the
kind ground-breaking features that we used to
enjoy, but that’s probably a good thing. All those
features and breaking changes we used to
love five to 15-years ago were a
consequence of desktop Linux still
being rather new. Now that
Ubuntu’s desktop is established,
like it or not, it doesn’t make
sense to go changing it.
Instead, we should take
comfort in the fact that after
four years of using Gnome for
> One thing that was quite hard to screenshot (but for once not its flagship desktop, the
because of Wayland) was the new screenshot tool. Oh the irony! experience is now second to
A common Theme
Gnome themes have come under the
spotlight since the introduction of
GTK4 (inaugurated with Gnome 40).
Did we say themes? Ah, we meant
theme, because custom theming of
Gnome applications is now verboten.
The cefault GTK3 theme was called
Adwaita, a Sanskrit word often
translated as ‘the only one’, (literally
‘not two'). But it wasn’t really the
only one, because developers could
happily write their own CSS stylings.
In GTK4 this theme has been
promoted to a platform library,
Il
libadwaita. which Gnome
/
developers say will guarantee
conformance with their Human
Interface Guidelines. And (like the characters often say in everything else, including cleaning up the mess our > Menus in
titlebars. Amazon
Highlander) there can be only one. GTK3 applications will Gnome fonts ended up in post installation of KDE
search results in
still respect custom themes, but GTK4 ones will only Plasma. Tweaks also enables you to manage startup
the HUD. Ubuntu
support the limited changes (for example, background programs, change titlebar button visibility (or move them
16.04 had some
and accent colours) permitted by libadwaita. to the left, MacOS style) and adjust legacy theming. You crazy ideas!
For Ubuntu 22.04 this might be bad news, because at can install Tweaks with:
present it uses a mix of Gnome 42 applications $ sudo apt install gnome-tweaks
(libadwaita-based) plus some from older releases (such This will install a different Extensions tool, currently in
as Files, which is based on GTK3 and libhandy). This beta form. At the time of writing this doesn't let you
may change prior to release, otherwise there are going to install new extensions, otherwise we could do away with
be some cosmetic inconsistencies. If this bothers you, the previous tool. For even more tweakability, try Just
then you might want to run away from Gnome 42 for the Perfection, found in Extension Manager. It allows for parts
next little while, in which case there are some suggestions of the shell theme to be overruled (including removal of
in the box (see below). the top bar) to make matters more minimal. We don’t go
The old Gnome Tweaks tool is still available in the for Gnome extensions ourselves (despite having two
repo, but like the EGO website it can no longer manage programs for managing them), let us know what we’re
Gnome extensions. That's okay, because it can do most missing out on. Enjoy Ubuntu 22.04!
Looking elsewhere?
Latterly there seems to have been a bit of a trend for Linux-leaning We're excited to see more people trying Fedora. It's now more
social media channels to announce they’re "no longe' recommending accessible, particularly as regards installing non-free software.
Ubuntu” or other such things. Reasons are varied, we suppose, but the Together with its rapid release cycle this makes it a great platform for
triumvirate of Snaps, Wayland and Gnome don’t seem to be to gaming. Well worth checking out if Ubuntu is no longer serving you.
everyone’s taste.
We'd still heartily recommend Ubuntu to anyone, beginner or
otherwise - as it “just works". Even if you don't like it. as we've seen it
can be customised, extended or otherwise bashed around to your
taste. Lots of the distros these channels recommend in Ubuntu’s stead
are themselves based on Ubuntu - for example Linux Mint. Pop!_OS
and Elementary OS. All great distros that offer something which is hard
to recreate on Ubuntu Linux, but ultimately distros that depend on its
packages, infrastructure and documentation.
Until now. perhaps.
Mint’s latest Debian Edition (LMDE5) is rapidly gaining traction.
Pop!_OS has moved its PPA repositories away from LaunchPad and is
working on a new Rust-powered desktop environment (with a view to
moving away from Gnome). And Elementary OS has had its own app
store for a while and has likewise sided with Flatpaks over Snaps. In
summary, if Ubuntu doesn’t do it for you. there are plenty of
derivatives you can switch to without having to learn a whole new way
of working. > Fedoras and the distribution of that name are all the rage right now.
of Linux!
How a 21-year-old’s bedroom coding project took over
the world and a few other things along the way.
30 years of Linux
“A 21-year-old, barely
able to afford an Intel 386
DX33, was about to start
a development process
that would support a
software ecosystem...”
Pre-Linux development
Discover how Unix and GNU became the foundation of Linus Torvalds’ brainchild.
o understand how Linux got started, you need to open approach. This enabled free experimentation,
At the end of the 1980s, the Unix story got messy, The GNU Project was established by Stallman in
with commercial infighting, competing standards and 1983, with GNU being a hilarious (to hackers, at least)
closing off of standards, often dubbed Unix Wars. While recursive acronym for “GNU is Not Unix." Geddit? Its
AT&T, Sun Microsystems, Oracle, SCO, and others aim was to establish a free OS ecosystem with all the
argued, a Finnish boy was about to start university... tools and services a fully functioning OS requires. Do
keep in mind that most of the tools created then
We GNU that are still being used and maintained today.
Before we dive into the early world of Linux, there's By 1987, GNU had established its own compiler, GCC,
another part of the puzzle of its success that we need to the Emacs editor, the basis of the GNU Core Utilities
put in place: the GNU Project, established by Richard (basic file manipulation tools such as list, copy, delete
Stallman. Stallman was a product of the 1970s and so on), a rudimentary kernel and a chess engine
development environment: a freethinking, academic, (See LXF273). But more importantly, Stallman had
hippy type. One day, he couldn’t use a printer, and cemented his ideal of software freedom with the 1989
because the company refused to supply the source
code, he couldn’t fix the issue - supplying source code
was quite normal at the time. He went apoplectic and
“He established a free software
established a free software development revolution: an
entire free OS ecosystem, free software licence and
development revolution: an
philosophy that's still going strong. Take that, entire free OS ecosystem, free
proprietary software!
software licence and philosophy
that’s still going strong.”
“copyleft" GPL software licence, and his manifesto
setting out the four software freedoms enabling users
to run, study, modify and distribute any software -
including the source - for any reason.
The GPL remains the strongest copyleft licence, and
while it has perhaps fallen out of vogue, it's still regarded
as the best licence for true open-source development,
and cements most Linux distros. GCC is still an industry
standard, Emacs remains a feature-rich development
environment, and the GNU Core Utilities are still widely
used in certain POSIX systems and most Linux distros.
You could argue that without the GNU Project being
established, Linux would never have taken off. The GPL
licence (adopted early on in Linux development) forces
all developers to share back their enhancements to the
source code. It’s a feedback loop that promotes shared
improvements. Alternative open-source licences enable
corporations to take source code and never share back
improvements, meaning the base code is more likely to
> Linux Format interviewed Richard Stallman, the creator of
remain static. This was backed by a generation of
the GNU free software movement, in 2011.
J LINUX
a million dollars required for Platinum status) provide interviews and coverage from the
a great deal of code to the Kernel. In 2012, annual Open Source Summit. We look forward
when Microsoft wanted to get Linux working to conference season resuming, so we can get
— FOUNDATION on its Azure cloud, they were for a time the back to the snack bars and coffee counters.
>The Human
theme was an
attempt to
make Ubuntu
Linux more
friendly, because
as everyone
knows brown
is beautiful,
especially if
you're a warthog.
disk partitioning, and be able to discern which packages they against its achieving all of these adjectives. One of the major
required from often terse descriptions. enablers was its strict adherence to the Gnome Human
Windows XP was released in October 2001, and Interface Guidelines, which set out some key principles for
while this was seen as a vast improvement over its application designers.This meant the desktop was consistent
predecessor, many users found that their machines not just internally, but in respect to all the GTK apps that
weren't up to running it. After all, it required 64MB RAM people would go on to write for it.
and a whopping 1.5GB of disk space. Remember that Also released was KDE 3, which vaguely resembled
BIOSes had only recently gained the ability to address Windows - in that it was cosmetically similar and
large drives (there were various limits, depending on the slightly more resource-demanding than Gnome. People
BIOS, 2.1,4.2 and 8.4GB were common barriers), So and distributions sided with one or the other. SUSE
many people couldn't install it on their hardware, and Linux (predecessor of openSUSE) always aimed to be
many that met the minimum specs found the desktop agnostic, but went KDE-only in 2009. Today it
performance rapidly degraded once the usual pantheon caters to both Gnome and KDE.
of office suites and runtime libraries were installed. In late 2002, ‘DVD’ Jon Johansen was charged
This provided the motivation for another minor over the 1999 release of the DeCSS software for
exodus to Linux, and the retro-hardware contingent circumventing the Content Scrambling System (CSS)
continue to make up a key part of the Linux userbase used on commercial DVDs. This software enabled Linux
(and berate us for not including 32-bit distros). Before users to play DVDs, a feat they had been hitherto unable
2006 all Macs had PowerPC processors, and many of to do since DVD software required a licence key from
these (as well as early Intel Macs), long-bereft of the DVD Copy Control Agency, one of the plaintiffs in
software updates from Apple, now run Linux too. the suit. It later emerged that CSS could be broken
much more trivially and Johansen was eventually
Gnome makes an appearance acquitted. By this time iPods and piracy meant that
The Gnome 2 desktop environment was released in 2002 and MP3 files were commonplace. These were dogged by
this would become a desktop so influential that some still patent issues with a number of bodies asserting
seek (whether out of nostalgia, atavism or curmudgeonly ownership of various parts of the underlying algorithm.
dislike of modern alternatives) to reproduce it. It aimed to be As a result, many distros shipped without patent-
as simple, tweakable and intuitive, and it's hard to argue encumbered multimedia codecs. The law is murky
Linus announces on
1
vO.Ol Posted on ftp.funet.fi vO.lO Linux is self-building v0.12 GPL licenced
comp.os.minix This release includes Bash vl.08 Linus overwrites critical parts of Linux originally had its
Linus Torvalds, a 21-year-old and GCC vl.40. At this time, the his Minix partition. Since he own licence to restrict
student at the University of source-only OS couldn't boot into Minix, he commercial activity.
Helsinki, Finland, starts toying is free of any Minix code decided to write the programs Linus switches
with the idea of creating his own and has a multi-threaded to compile Linux under itself. to GPL with
clone of file system. this release.
e the Minix OS.
7 MARCH 1992 14 MARCH 1994 7 MARCH 1995 9 JUNE 1996 20 FEBRUARY 2002
T
vO.95 X Windows
A hacker named Orest
vl.0.0 C++ compiled
The first production release.
vl.2.0 Linux ‘95
Portability is one of the first
v2.0.0 SMP support
Symmetric multiprocessing
V2.5.5 64-bit CPUs
AMD 64-bit (x86-64)and
»
Zborowski ports Linus had been overly issues to be addressed. (SMP) is added, which PowerPC 64-bit
X Windows optimistic in naming v0.95 This version gains support made it a serious are now supported.
to Linux. , u and it for computers using contender for many
f
v2.6.0 The Beaver Detox v2.6.19 ext4
r ?
V2.6.20 KVM arrives
t
v2.6.28 Graphics rewrite
Major overhaul to Loadable Experimental support for the Kernel-based Virtual Machine The Linux graphics stack was
Kernel Modules (LKM). ext4 filesystem. (KVM) is merged, adding Intel fully updated to ensure that it
Improved performance for and AMD hardware visualisation utilised the full power of modern
enterprise-class hardware, the extensions. GPUs.
E scheduler.
Distro developments
A single kernel has enabled a good number of
Linux distributions to blossom into life.
fter looking into the development of the Linux
Primordial soup
As L nux vO.Ol was only released in September 1991, > The first
the first distribution of Linux - though by modern maintained by individuals, groups, or businesses. Linux distro,
standards, it’s lacking in every department - created by Once they’re established, stable and become popular, aptly named:
HJ Lu, was simply called Linux 0.12. Released at the end offshoots branch from these root distros offering new Linux 0.12.
of 1991, it came on two 5.25-inch floppy disks, and specialisations or features. This creates a number of
required a HEX editor to get running. One disk was a base distro genera, formed around the original package
kernel boot disk, the other stored the root OS tools. manager and software repositories.
In those early days of distro evolution, things The effect is a Linux family tree (see page 43), where
changed rapidly. Development was quickly adding base you can date all distros back to an initial root release.
functionality, and people were trying out the best ways Some branches sprout and die: either the group
to package a Linux-based OS. MCC Interim Linux was maintaining it disbands or there's no wider interest.
released in February 1992 with an improved text-based Some branches become so popular they create a whole
installer, and was made available through an FTP server. new genus, becoming the basis for a further expansion.
X Windows - the standard Unix windowing system -
was ported, and TAMU Linux was released in May 1992 Evolution, not revolution
with it packaged: making it the first graphical distro. As with plants and animals, offshoots inherit traits,
While all of these are notable as being among the the base install, package manager, and software
first Linux distros, they didn’t last. The same can be said repositories being key. A package manager is how
for Softlanding Linux System (SLS), also released in the OS installs, updates, removes and maintains the
May 1992, which packaged X Windows and a TCP/IP installed software, which includes downloading software
network stack. It’s notable, though, because of its packages from the managed software servers, called
shortcomings (bugs and a change to the executable repositories. This can become contentious - these child
system) inspired the creation of the two longest-running distros are leeching off the parent’s bandwidth - but
and, in many ways, most influential Linux distros: initially, while they’re growing, this use won’t look much
Slackware and Debian. different from normal user activity.
Nowadays, a number of base distros appear, reliably Bear in mind we’re back in 1992. You’re lucky if
■Will
v3.0 20 years young
t
v3.3 EFI Boot support v4.0 Hurr Durr v5.0 Shy Crocodile
v6+ The future...
This version bump An EFI boot stub enables an Who knows what the next 30
I’ma Sheep released Major additions include
isn’t about major x86 bzlmage to be loaded WireGuard. USB 4,2038 fix. years has in store for Tux.
Linus Torvalds decides to
technological changes, but and executed directly by Watch this space - and
poll the decision to Spectre fixes, RISC-V
keep reading
instead marks EFI firmware. increment the next release support, exFAT,
Linux Format!
the kernel’s to 4.x. It also approved the AMDGPU and so
20th anniversary. I name. much more!
Microsoft Linux
there's a 14.4Kb/s dial-up modem at home: expensive many other distros have taken on modern
T1 lines (1.54Mb/s) are limited to academic institutions enhancements, Volkerding sticks to older more
and larger businesses. The early TAMU vl.O distro traditional “Unix" ways of controlling services on
required 18 disks for the 26MB binaries, and 35 disks for Slackware. There's no formal bug tracking, no official
the 50MB compressed (200MB uncompressed) source way to contribute to the project, and no public code
code. This obviously limited access in these early days repository. This all makes Slackware very much an
to academics and those in suitable businesses, so distro oddity that stands on its own in the Linux world. Due
evolution was slow. to its longevity, however, Slackware has attracted a
couple of dozen offshoots, and at least half are still
Meet the ancestors maintained today.
Softlanding Linux System was popular, but it was buggy In August 1993, Ian Murdock, also frustrated by
and badly maintained, so in July 1993, Patrick Volkerding Softlanding Linux System, established Debian, a
forked SLS and created Slackware - so named because combination of "Debby," his girlfriend’s name at the
it wasn’t a serious undertaking at the time, and was a time, and "Ian." From the outset, it was established as
reference to the Church of the SubGenius. This is the a formal, collaborative open project in the spirit of
oldest Linux distro still maintained, and it’s about to see Linux and GNU.
> Thankfully,
its version 15 release after 28 years. Slackware is Early on in the Debian project. Bruce Perens
by being buggy
SoftLandingLinux interesting because it’s very much controlled and maintained the base system. He went on to draft a
kickstarted some maintained by Volkerding, while followed by a small but social contract for the project and created Software in
good distros! enthusiastic band of users and contributors. Whereas the Public Interest, a legal umbrella group to enable
Debian to accept contributions. At the time, Perens was
|| ISoftlanding Linux System SLS MESH SHELL (c) 1994 Softlanding Software
working at Pixar, so all Debian development builds are
k / named after Toy Story characters. The Debian logo
Perm Size File Perm Size File also has a strong similarity to the mark on Buzz
। drwxr-xr-x Z Lightyear’s chin.
drwxr-xr-x z drwxr-xr-x 2
drwxr-xr-x 2 bin/ drwxr-xr-x 2 bin/
Debian is arguably the single most influential and
drwxrwxrux Z boot/ drwxrwxrwx Z boot/ important Linux distro ever. Just the sheer number of
drwxr-xr-x IO dev/ drwxr-xr-x 10 dev/
drwxr-xr-x 4 etc/ drwxr-xr-x 4 etc/ branches of distros from it would attest to that, but
drwxr-xr-x Z home/ drwxr-xr-x Z home/
Debian is renowned for its stability, high level of testing,
CRED IT: Linuxcenter.ru
The RASPBERRY Pi
The Raspberry Pi was released in 2012. only ever expected to have been produced in BBCs, Spectrums and Commodore 64s are
Inspired in part by the success of the BBC the thousands. Of course when it was reliving and reviving the thrills at the interface
Micro (hence the monogram launched, Linux was the de facto OS of choice. of coding and creativity. The Raspberry Pi's
model names) in the early 1980s. the While many of these devices are now GPIO pins mean that all manner of add-ons
Raspberry Pi aimed to bring practical empowering young coders, a great deal have have been developed, so that the pint-sized
computer science to the classrooms and become part of diverse man-cave projects: computer can power anything from robots to
bootstrap the UK electronics industry. It was The 30-somethings who cut their teeth on remote watering systems.
The lingua franca of Pi projects is Python
which, like Basic, is easy to learn. Unlike Basic,
though, it's consistent, extensible and won't
eed to be unlearned should users
move on to more advanced languages.
The Pi's support for 3D graphics is
impressive, but CPU-wise it’s more limited.
The orig nal Pis struggle to function as a
desktop computer, even with the modest
Raspbian distribution (although recent work
on the Epiphany web browser has improved
this).
In 2015 the Pi received the Pi 2 reboot,
gaining a quad-core processor and extra RAM,
and yet still only cost £25. Jump forward six
years and we have the Pi 4 in its various forms
including a full-desktop capable 8GB version
the Pi 400. a range of industry-friendly models
and over 30 million sales. Splendid.
in October 1994, Red Hat Linux was publicly released. Meanwhile in Germany. SUSE (Software > Debian is
Red Hat was established as a for-profit Linux business, und System Entwicklung) started life as a commercially the distro that
launched
initially selling the Red Hat Linux distribution and going sold German translation of Slackware in late 1992. In
more distros
on to provide support services. Red Hat went public in 1996, an entire new SUSE distro and business was
than any other!
1999. achieving the eighth biggest first-day gain in the launched, based on the Dutch Jurix Linux, selling the
history of Wall Street. It entered the NASDAQ-100 in new distro and support services.
December 2005 and topped $1 billion annual revenue in SUSE was purchased by Novell in 2003, and in 2005,
2012. IBM purchased Red Hat in October 2018 - 24 the openSUSE community edition was launched, while
years after its first release - for $34 billion. So that SUSE Linux Enterprise was developed in tandem for its
worked out very well. commercial arm. SUSE was acquired in 2018 for $2.5
billion and returned double-digit growth through 2020,
A tale of hats and forks with a revenue of over $450 million. Yet despite its
Red Hat Linux was relaunched as Red Hat Enterprise in 2001, success, SUSE and openSUSE have only ever attracted
and its commercial success attracted a wide range of forks. a couple of forks. We could be wrong when we say this is
Notably, Red Hat directly supports Fedora as its testing distro possibly down to their European roots.
and CentOS as its free community edition. Or it did. CentOS
is being shuttered - to understandable community disdain - It’s a distro inferno
and a rolling release, CentOS Stream, is replacing it. As an Between the creation of Red Hat in 1994 and 2000,
alternative, Red Hat Enterprise is now offered freely to there were a number of Red Hat spin-offs, because at
community projects with fewer than 16 servers. that point there was clear commercial interest in Linux.
Throughout this period, Linux was best suited to
business server tasks, where much of the open-source
Unix work had been focused. However, by the end of the
1990s, 56k modems had become commonplace, early
home broadband was just appearing, and modern
graphical desktops were in development. Linux was
about to get a whole new audience.
CREDIT: Based on the LinuxTimeLine, by fabiololix, GNU Free Documentation License vl.3, https://github.com/FabioLolix/LinuxTimeline/tree/master
One early example was Mandrake Linux, in mid-1998. A hard to measure - when users are polled. Why Ubuntu
fork of Red Hat, it was crazily aimed at making Linux became so popular is hard to fully pinpoint. Key is just
easy to use for new users, using the new Kool Desktop like Mandrake before it, Ubuntu set out to make desktop
Environment (KDE). The French/Brazilian development Linux easy for first-time users. It also offered the distro
team gained a lot of attention but, ultimately, financial on free CDs via its Shiplt service until 2011, alongside
problems closed the project in 2011. However, its spirit fast, reliable server downloads. Furthermore, it was
continues in the excellent but less well-known Mageia based on the popular Debian, it jumped on the new,
and OpenMandriva projects. slick Gnome desktop, and it set out a regular six-month
release cycle, with a Long Term Support release every
A distro with humanity in mind two years. Support was for 18 months (now nine
With Mandrake pointing the way, the early 2000s saw an months) for regular releases, and 36 months for LTS
explosion of distro releases. Now that the Debian project at ones (now five years).
this point was well established, well regarded and well known, Ubuntu also offered great forums and help sites,
it became the basis for hundreds of Linux distros. But we'll along with a community council, and support for forks
only mention one: Ubuntu, released in 2004 by South African such as Xubuntu, Lubuntu and many others. It had sane
millionaire Mark Shuttleworth, who jokingly calls himself the defaults, too, and made it easier to install display drivers
self-appointed benevolent dictator for life. The Ubuntu (an absolute pain 10-plus years ago), while offering a
Foundation was created in 2005 as a philanthropic project - huge catalogue of tested, ready-to-run open-source
Ubuntu is a Zulu word meaning humanity - to provide quality software and dedicated server builds. We guess when
open-source software, with Canonical as the supporting you say all this out loud, it sounds pretty compelling!
commercial arm. Two core release branches we'll quickly mention are
Ubuntu as a branch of Debian has itself seen over 80 Arch Linux and Gentoo, both released around 2000.
distros fork from it. while Ubuntu has the highest share Gentoo (named after the fastest penguin in the world) is
of all desktop Linux installs - though this is notoriously a built-from-source distro compiled with specific
optimisations for the hardware it's going to run on. This
is very clever, but also very time-consuming. Google
Chrome OS is derived from Gentoo. In early 2002, Arch
Linux was released, devised as a minimalist distro,
where the user does much of the installation work to
create an OS with just the parts required. This DIY
approach was partly why Arch is renowned for its
amazing documentation and for rolling out the earliest
> With big bucks, release of new versions of software.
comes big offices! At the height of the distro madness (around 2010),
Here’s the Red there were almost 300 Linux distros, we'd argue an
Hat HQ sporting unsustainable number, with many just repeating basic
its old logo.
desktop functionality already available in core root
CREDIT: Bz3rk, CC BY-SA 3.0 https://en.wikipedia.Org/wiki/Red_Hat#/media/File:Red_Hat. distros. Progressing into the 2000s. and with increasing
headquarters_at_Raleigh._North_Carolina._US_-_9_November_2013.jpg
complexity in maintaining a
modern OS, the number of Linux distros, such as Android, Chrome OS, Intel's ClearOS,
distros started to reduce, but that didn't stop well- Google’s Wear OS, Sailfish OS, and the host of server
organised groups creating popular new distro forks specific distros. Even today, there are well over 200
when they felt a need. active Linux distros, and they’re as diverse, interesting,
A good example is Raspberry Pi OS, a rebrand of and wonderful as the communities that use them.
Raspbian, itself a fork of Debian. The new Arm-based
hardware platform needed a dedicated operating Looking forward
system, so picking up Debian and refitting it for the But what of the future? Technology predictions are
Raspberry Pi, including educational software, libraries notoriously tricky, but why would we ever let that stop
for its GPIO access, and tailored tools to configure its us? Will Tux still be active in 30 years? We’d say that’s a
hardware, made absolute sense. safe bet; even if all development stepped now, people
Linux hardware specialist System76 was tired of would keep on using it for years if not for decades.
niggling software issues associated with using other There are retro computer systems that are still ticking
distros, and wanted direct control. So, it introduced over almost as long later, and the Linux kernel is far
PopLOS, a fork of Ubuntu, to not only directly support more functional than they ever were.
its laptops and desktop hardware, but also its A more likely scenario is Google, as an example,
customers’ needs. It's a slick, modern distro. with moving to an alternative kernel - Fuschia, say - though
support for popular software and hardware. this would likely just be for Android and its loT devices.
Linux Mint started in 2006 as a small personal Yet even if Google moved literally everything it runs to
Uburtu fork project. When Ubuntu changed to its Fuschia, the Linux kernel is used so widely elsewhere
"modern” Unity desktop design in 2011, many users that it would just keep on trucking.
revolted. The Linux Mint project created its own As we've seen, the Linux world is larger than just its
"classic" desktop, called Cinnamon, in 2012, and it kernel. An OS is a whole ecosystem of interconnected
brought many former Ubuntu users with it. The Linux systems that have to be developed, tested and
Mint project has stuck with its “user first" design packaged in an orchestrated manner. Linux was built on
approach, and evolved remarkably well. GNU tools and its licence: this widened the appeal of
This doesn’t even touch upon commercially focused Linux and enabled the kernel with suitable distros to be
deployed in such vastly differing devices, from the
fastest super computer in the world to a lowly $4 Pi.
The Linux kernel isn’t tied to the success of any one
corporation. Sure, there’s the Linux Foundation and
Torvalds himself, but succession has already been put
into place to keep kernel development going if Torvalds
should step down. And while the Linux Foundation isn’t
necessary, it's certainly handy to orchestrate and
handle funding and trademarks.
Put all of that aside, the reason Linux has succeeded
is that it’s damn good at its job and everyone can
contribute. It’s the single greatest software development
project of modern times, which doesn't mean it's
perfect - it's software after all - but it’s continually
improved and enhanced, it's strong copyleft open
source, it fostered a fabulous community and it’s given
Linux Mint became one of the most popular distros by, us all endless opportunities. So keep on enjoying it!
unbelievably, giving users what they wanted!
.Illliill'ill
IHimUiiil
H I I I I .liii
inux, if you want to be annoyingly of the operating system, as well as some it's mere or less mandatory there. But it's
won’t work. This firmware is generally not included in ;xo stable: 5.16.7 2022-02-05 [tarball] (pgp) (patch] [Inc. patch] (view dlff] (browse] (changelog]
longterm1 5.15.21 2022-02-05 (tarhall) (pgpj (patch) [me patch] (view cliff] (browse] (changelog]
distribution’s kernel source packages (since it’s not
> A smorgasbord of kernels can be found at https://kernel.org, from
source code and sometimes proprietary), but rather
bleeding edge-RCs, to the SLTS 4.4 series.
shipped in a separate linux-firmware package.
Compiling a kernel
Get straight to business and build your own Ubuntu-esque kernel
o compile your own kernel using Ubuntu $ apt source linux-image-unsigned-$(uname -r)
We can find out more about a particular option by Note this is documented precisely nowhere. Finally
highlighting it and pressing F2. Doing this in the kernel let’s build the thing:
compression mode option tells us something about $ fakeroot make-kpkg -j “$(nproc)” —initrd -append-to-
which compression options work best on what system, version-’+lxf” kernel-image kernel-headers
as well as a considered note about who to contact Now make a cup of tea because the stock Ubuntu
if certain options don’t work. Let’s switch to LZ4 kernel is rather fully featured. You’ll see files being listed as
compression and see if we can spot a difference. they’re being compiled, linked and generated. It’s
reasonably pleasing to watch, but you may need another
See what’s on the SLAB cup of tea. On our XPS13 it took most of a lunch hour
If you like odd-sounding acronyms, have a look in the (Who said you were allowed an hour for lunch!? - Ed) to
Choose SLAB allocator menu (towards the bottom of the finish up, over the course of which it got rather hot. Even
General setup menu). Before you get dragged in Covid-free draughty corridors of Future Towers.
deep into the rabbit’s warren of kernel options, exit by All going well you should see twc .deb packages in
pressing F9 and make sure you save the configuration. your home directory (not the source directory): one
You’ll be told it’s stored in a file named .config. containing the kernel image, and one containing the
One slight quirk with using the Ubuntu kernel is that headers. We’ve been careful to only do a very trivial
it’s configured by default to use Canonical’s Trusted modification (so, only changing the compression
System Keys. Because these aren’t included in the format) for our first outing. And with good reason.
kernel sources, the build will fail without some These packages are going to replace the current kernel
intervention. We can either manually disable the keys packages on the system. This shouldn't really be a
(they’re deep in the Cryptographic Services menu), problem since Ubuntu always has a fallback kernel on
or we can use the helpful Debian scripts: hand, but we don’t really want our first effort to result
$ scripts/config -set-str SYSTEM_REVOCATION_KEYS in a kernel panic. See how you fare with:
$ scripts/config -set-str SYSTEM_TRUSTED_KEYS $ sudo dpkg -i linux-‘.deb
This sets these to blank strings. The config program The kernel should be installed as Grub’s new default.
also has a -disable argument, but if you use that here Check after a reboot with the uname-a command, and
it breaks because a string value is required here. if necessary hold down Shift to bring up a boot menu.
Kernel minification
Perfection is reached not when there’s nothing left to add,
but rather when there’s nothing left to take away...
y this point the chances are you’ve already had a Another reason for removing things is demonstrated
Popular patches
Forget trawling through configs - use a pre-rolled patchset to set the rules.
e’re always impressed by Colorado-based can set program 'niceness’ manually using the renice
same priority, then the process processes don't make for choppy audio output.
One of the earliest and most popular patchsets
with the lowest niceness takes for the kernel is Con Kolivas’ “CK” effort. Starting out
as a set of tweaks to improve desktop performance,
precedence.” it evolved to include a series of new CPU schedulers,
culminating in BPS (the middle letter of which stands for
something rude) in 2009. Kolivas has in the past voiced
Garuda Linux is making a lot of headlines lately. The concerns about kernel developers’ lack of interest in the
slick, eye-candy heavy. Arch-based distro includes a desktop. But with BPS (and much of his scheduler work)
couple of daemons that ought to improve the intention was never to get it mainlined. It’s not
responsiveness. First there's Ananicy (ANother Auto general purpose enough for the kernel, and the kernel
NICe daemon), which automatically renices (gives has only one scheduler anyway (the Completely Fair
greater affinity) processes. The idea here (as with any Scheduler, CPS'). BFS has since been retired in favour of
scheduling tweak) isn’t to magically give you more MuQSS (Multiple Queue Skiplist Scheduler), which was
> Get Garuda’s
speed. Rather, it’s concerned with tweaking priorities so introduced in 2016.
kernel goodness
that heavy tasks (like compilation or indexing) don’t If you want to try out MuQSS, you can grab the
without the icon
garishness, with interfere with things happening in the foreground. patches directly and apply them to a vanilla source tree
Linux-TKG Nicing is a feature of the Linux kernel itself, and you (see https:Z<github.com/ckolivas/linux for
instructions). Alternatively. MuQSS has been included in
O Firefox web Browser •
various custom kernels, namely Liquorix (https://
Welcome | Carvd* Lino x Ixf^lxf-SUndard
liquorix.net) and Linux-TKG. The latter includes a choice
Q OS h«ps://wiki 2orudalinux.org erb r oni. lxf^xf-SUndardPC-935-l... txf@>lxf-SUn
Researching Clang
Using Clang requires (at least) the dang, llvm and lid
packages to be installed. And if you're on Ubuntu 20.04
you'll have to work around the older (version 10 series) in
the repos. DuckDuckGo is your friend here...
You’ll be asked several more questions, and some of
them have defaults which you should probably stick to at
first. Kernel Timer frequency has been the subject of
> Any excuse to feature a Pop!_OS background. They also some debate over the years, and TKG's default of 500Hz
make bespoke scheduler tweaks now seems to fit sensibly in the middle of the generic kernel
default of 250Hz, and the 1,000Hz setting currently used
$ sudo apt install git by some low-latency kernels. Finally you’ll be asked if you
$ git clone https://github.com/Frogging-Family/linux-tkg. want to run nconfig (or any of the other kernel
git configuration interfaces) for any final tweaks.
$ cd linux-tkg Once again now is a good time to make a cup of tea,
There’s a helpful installation script which we'll run in as kernel sources have to be cloned, patched and
a moment, but do read the documentation before doing configured. Any kernels generated this way must be
so. There’s also a config file customization.cfg that can removed manually, but the script can help with that. In
influence the script’s behaviour. Like make-kpkgthe general, any custom kernel you build as a DEB package
script will build DEB (or RPM if you’re using Fedora) should be easy to remove, but always keep an eye on
packages which can be installed like any other software. your /boot directory for ancient artefacts. We’d dearly
See how you get on with: love to cover more kernel patches, in particular Xanmod,
$ ,/install.sh install but it looks like we'll have to leave these explorations to
You'll be asked which distro you're using (there's a you. Do let us know how you get on!
generic option, but in general if you choose something
close to your distro it should work). Next you'll be asked
which kernel version you want to install. They’re listed Q Q clang orq
The Clang-ers
Some distros, such as Alpine and Android, language in which most of the kernel is Furthermore, a binary compiled with Clang
include very few GNU components (for written) as well as the GNU C extensions. can be investigated with advanced static and
example, muslibc and Bionic are used, There are technical reasons for using Clang dynamic analysis tools from the LLVM suite.
respectively, instead of the GNU C library). These can help find bugs. And yes. this means
as opposed to GCC. First, it makes
Most distros are still using GCC to compile compilation for different platforms easy. A that using Clangto compile the kernel can
their kernels, but for many years now it has result in a performance increase. As well as
binary compiled with Clang (m what's called
been possible to use the LLVM/Clang this, since Linux 5.12 (February 2021) the
the LLVM Intermediate Representation) can
compiler instead. Android and ChromeOS do kernel has supported LTO (link-time
target, after being processed by the
this, and so does OpenMandriva. LLVM (the optimisations) with Clang.
appropriate LLVM backend, multiple
Low Level Virtual Machine) is a toolchain This exercise enables the kernel to be
architectures. Currently, building the kernel is
based around C++ objects, and Clang is a optimised as a whole, instead of in the context
only supported for ARM and x86 targets, but
frontend to LLVM that supports C (the of individual source files.
others (MIPS. RISC-V, PowerPC) are available.
Rescatux:
Repair & rescue
A one-stop lifebuoy to rescue your computer no matter if it’s
running Linux or Windows.
o many things can mess up your computer. A careless
One-touch repair
Many issues with the Grub2 bootloader can be computers with the GPT layout. Boot-Repair is the tool also spits out a small URL which you
resolved with the touch of a button thanks to the available under the Expert Tools category in the should note. The URL contains a detailed
Boot-Repairapp. The nifty little app has an Rescapp utility. When you launch it. the app will summary of your disks, partitions along with the
intuitive user interface and can scan and scan your hard disk before displaying you its contents of important Grub 2 files including /
comprehend various kinds of disk layouts and simple interface that's made up of a couple of etc/default/grub and boot/grub/grub.cfg If
partitioning schemes and can sniff out and buttons. Most users can safely follow the tool's the tool hasn't been able to fix your bootloader,
correctly identify operating system installations advice and simply press the Recommended you can share the URL on your distro's forum
inside them. The utility works on both traditional repair button which should fix most broken boards to allow others to understand your disk
computers with MBR as well as the newer UEFI bootloader. After it’s restored your bootloader. layout and offer suggestions.
only, it's best to run feck from a Live CD without mounting the Security Account Manager (SAM) file. Usually it'll only list one
partition. To do this, boot Rescatux and select the File System partition, but if you have multiple Windows flavours, the
Check (Forced Fix) option. This will probe your computer and wizard will display multiple partitions. Select the one which
list all the partitions. Select the one that was spitting errors houses the user whose password you wish to recover. Use TestDiski
and Rescatux will scan and fix any inconsistencies. Rescatux will then backup the registry files before displaying Deeper Search
option toscan each
a list of users it finds on the partition you just selected. Select
cylinder and the
Boot camp the user whose password you wish to reset and Rescatux will superblocks to find
One of the most common issues that plagues Linux users is a wipe its password. You can then restart the computer, reboot missing partitions
botched up boot loader. It really doesn't take much effort to into Windows and login into the user you've just reset and if the default Quick
end up with an unbootable computer. The Master Boot Windows will let you in without prompting for a password. Search option isn't
able to unearth
Record (MBR) is located in a special area at the start of every Similarly, you can use the Promote Windows user to
them.
hard disk and helps keep track of the physical location of all Admin option to do exactly that. This option too will scan and
the partitions and also holds the bootloader. All it takes is a list all Windows partitions that house the SAM file. Select the
wrong key press in fdiskor gpartedcan wipe the MBR. one you’re interested it to view the list of users. Select a user
Rescatux includes several options to regenerate the GRUB from this list and Rescatux will tweak Windows to give it the
boot loader and fix the MBR. There's the Restore Grub option same privileges as an administrator. This mechanism works
which will first scan your computer for all partitions and read for all version of Windows including Windows 10 as well as
their identification information from the /etc/issue file. It'll long as they are secured by a password. However it will not
then display them in a list and ask you to select your main work if you've selected another mechanism to lock your
Linux distribution. Next it probes all the disks connected to account such as a PIN.
the computer and asks you to select the one on which you The newer version of Rescatux include the Easy Windows
wish to install GRUB. If you have multiple disks, the menu will Admin option. This option provides you the ability to take
prompt you to reorder them according to the boot order. back control of a Windows installation by combining multiple > Rescatux is
Once it has all this information, it'll use the grub-install options to first blank the user's password and then promote based on Debian
and includes the
command from the selected Linux distro and generate a new them to the Windows Administrator.
Synaptic package
boot loader and place it in the MBR. If you are using a Debian You can also use Rescatux to change passwords on a
manager that
based distribution such as Ubuntu, you can use the option Linux installation and regenerate a broken sudoersfile. Select
you can use
labelled Update GRUB Menus. It takes you through the same the Change Gnu/Linux Password option to allow Rescatux to for installing
wizards as the Restore Grub option but is optimised to help scan your computer for Linux installations. additional
you add Debian-based distributions to the GRUB bootloader. Then select the Linux partition you're interested in to view disaster
The newer releases of the distro also include the Ease a list of users on that particular installation. The root user is » recovery tools
GNU/Linux Boot fix option. It runs a combination of three
options. It starts off by forcing a filesystem check before
running the update grub option and ends with the restore
grub option. On the face of things, you'll still be asked only to
select the main Linux distro and the disk that should hold the
GRUB bootloader. Behind the scenes, this new option uses
the information for the three previously mentioned tasks.
Open sesame
We've all been there. Crafting an obscure password won't do
you any good if you can't remember it. Instead of endless
trying permutations and combinations to hit the jackpot, you
can instead use Rescatux to set yourself a new one without
much effort. The distribution offers password recovery
options for both Linux and Windows installations.
If you've forgotten the password for your Windows
installation, fire up Rescatux and select the Blank Windows
Password option from the Rescapp utility. The distribution
then scans your computer for partitions that contain the
OS Uninstaller
formats. This is because Photorec names these files as it peek inside the destination folder, you'll see several folders
finds them and leaves the sorting to you. named recup_dir.l, recup_dir.2, and so on. The recovered
Also despite the fact that Photorec is a command-line files are saved under these folders. Manually sorting the files
utility, it breaks the process of recovering files into steps, would take forever. You could do some basic sorting from the Instead of wasting
much like a wizard. When you launch the tool, it will display all CLI to better organise the files. You can. for example, use the time sorting
hard disks and connected removable devices including any mv ~/recovered/recup_dir.7*.jpg ~/all-recovered-images to through all the
files recovered by
plugged-in USB drives. To proceed, select the disk with the move all the jpg files from under all the recovered folders into
PhotoRec you can
missing files. In case the disk houses multiple partitions, the all-recovered-images folder. ask the tool to only
Photorec will display all the partitions and lets you select the You can also sort files by their size, “his is very useful look for certain
one that housed the lost files. Next up. the tool needs to know especially when recovering images. In addition to recovering filetypes.
the file system type your files were stored in. It only presents the image itself. Photorec will also recover their thumbnails as
two options. Select the [ext2/ext3] option if the deleted file well which will have the same extension. The command
resided inside a Linux distro. The [Other] option will look for find ~/all-recovered-images/ -name “*.jpg” -size -10k I xargs
files created under FAT/NTFS/HFS+ or any other filesystem. -i mv {} -/thumbnails will move all images less than 10KB in
You’ll then have to decide whether you want to look for size out of the all-recovered-images folder.
deleted files only inside the freed up space or in the whole As you can see. Rescatux is an immensely useful
partition. The last step is to point Photorec to the folder distribution that can help you wiggle out of a tricky situation.
you've created to store all recovered files. While the heavy lifting is done by the powerful command-line
Armed with this info, Photorec will get to work and can open source tools and utilities, Rescatux makes them
take a while depending on the size of the partition. All the files accessible to inexperienced users thanks to its home-brewed
it finds are stored in the folder you pointed it to. When you menu-driven Rescapp utility. ■
reen->addch($st^9Ji| HM 99
I ^1 W^B^I 19
I
99
^^^kwBB 9 --- ^^
I |^
^■B B^B BIB M ™„ nmn ^_
9 9 B B ^k 9 9
9 9 ^k
Sals IEbb W* B ^b^^L
BWbB 9 9 9 9
■ w 91 IJK E ^1 ■ gEELJ^S JS &i I
■M
I I
B ^B
I
WB MH
^BWWI B S’ ^B &
WB HI^R^B
aprocessable_entity} $ bw .9B9B9. ^9M^. _g|. ^_^j__ , ^g Emigrate $
^9
ite_attributes(params[:task]) format.html 9
9 9hhbBsk^W
| ^9 :o9
^HBi^b9Rlse
9 bbh^9b ^^B ^^9 format.html {render action: “edit”} formatjson {rei
sc rails generate migration add_priority_to_tasks priority.integer $ bundle exec rake db:migrate $ bundle exec rake db:migrate $ bundle exec rails server validate
at, ‘is in the past!’) if due_at < Time.zone.now #!/usr/bin/en python import pygame from random import randrange MAX.STARS = 100 pygame.init() screen = py
ars = for i in range(MAXJSTARS): star = [randrange(0,639), randrange(0,479), randrange(l, 16)] stars.append(star) while True: clock.tick(30) for event in pygame.
humstars = 100; use Time::HiRes gw(usleep); use Curses; Sscreen = new Curses; noecho; curs_set(0); for ($i = 0; Si < Snumstars ; $i++) {$star_x[$i] = rand(80); $s
clear; for ($i = 0; $i < Snumstars ; $i++) {$star_x[$i] -= $star_s[$i); if (Sstar_x($i] < 0) {$star_x[$i] = 80;} $screen->addch($star_y[$i], $star_x[$i], “.”);} $screen->refre
rent, lest do gem “rspec-rails”, “~> 2.13.0” S gem install bundler $ gem install rails -version=3.2.12 $ rbenv rehash $ rails new todolist --skip-test-unit respond
nl {redirect_to ©task, notice: *...’) formatjson {head :no_content) else format.html {render action: “edit”} formatjson {render json: @task.errors, status: :unprc
ity_to_tasks priority integer $ bundle exec rake db:migrate $ bundle exec rake db:migrate $ bundle exec rails server validate :due_at_is_in_the_past def due_at_is_
ine.now #!/usr/bin/en python import pygame from random import randrange MAX_STARS = 100 pygame.init() screen = pygame.display.set_mode((640, 480)) c
star = [randrange(0, 639), randrange(0, 479), randrange(l, 16)] stars.append(star) while True: clock.tick(30) for event in pygame.event.getQ: if event.type = pyg
tes qw(usleep); use Curses; $screen = new Curses; noecho; curs_set(0); for ($i = 0; Si < Snumstars ; $i++) {$star_x[$i] = rand(80); $star_y($i] - rand(24); $star_s[$i]
s ; $i++) { $star_x($i] -= $star_s[$i]; if ($star_x[$i] < 0) { $star_x($i] = 80;} $screen->addch($star_y[$i], $star_x{$i], “.”);} $screen->refresh; usleep 50000; gem “then
Is”, “~> 2.13.0” $ gem install bundler $ gem install rails -version=3.2.12 $ rbenv rehash $ rails new todolist -skip-test-unit respond_to do Iformatl if @task.update_
’} format.json {head :no_content} else format.html {render action: “edit”} format.json {render json: @task.errors, status: :unprocessable_entity} $ bundle exec rails
exec rake db:migrate $ bundle exec rake db:migrate $ bundle exec rails server validate :due_at_is_in_the_past def due_at_is_in_the_past errors.add(:due_at, ‘is in tf
rgame from random import randrange MAX_STARS = 100 pygame.init() screen = pygame.display.set_mode((640, 480)) clock = pygame.time.Clock() stars = :
3(0, 479), randrange(l, 16)] stars.append(star) while True: clock.tick(30) for event in pygame.event.get(): if event.type = pygame.QUIT: exit(O) #!/usr/bin/perl $nt
■ new Curses; noecho; curs_set(0); for ($i = 0; Si < Snumstars ; $i++) { $star_x($i] = rand(80); $star_y($i] = rand(24); $star_s[$i] - rand(4) + 1;} while (1) { $screen-
]; if ($star_x[$i] < 0) { $star_x($i] = 80;} $screen->addch($star_y[$i], $star_x[$i], “.”);} $screen->refresh; usleep 50000; gem “therubyracer”, “~> 0.11.4” group :de\
ndler $ gem install rails -version=3.2.12 $ rbenv rehash $ rails new todolist --skip-test-unit respond_to do Iformatl if @task.update_attributes(params[:task]) forma'
nt} else format.html {render action: “edit”} format.json {render json: @task.errors, status: :unprocessable_entity} $ bundle exec rails generate migration add_priori1
exec rake db'.migrate S bundle exec rails server validate :due_at_is_in_the_past def due_at_is_in_the_past errors.add(:due_at, ‘is in the past!’) if due_at < Time.zon
ndrange MAXJSTARS = 100 pygame.init() screen = pygame.display.set_mode((640, 480)) clock = pygame.time.Clock() stars = for i in range(MAX_STARS): star =
snd(star) while True: clock.tick(30) for event in pygame.event.get(): if event.type = pygame.QUIT: exit(O) #!/usr/bin/perl $numstars = 100; use Time::HiRes qw(us
($i = 0; $i < $numstars ; $i++) { $star_x($i] = rand(80); $star_y{$i] = rand(24); $star_s[$i] = rand(4) + 1;} while (1) { $screen->clear; for ($i = 0; $i < Snumstars ; $i++)
reen->addch($star_y(Si], $star_x[$i], “.”);} $screen->refresh; usleep 50000; gem “therubyracer”, “~> 0.11.4” group development, lest do gem “rspec-rails”, “~> 2.13.0
Security
The best defence is a good
offence, but also a good defence.
46 Protect your privacy
Discover what threats are out there and
what you can do to protect your devices.
54 Kali Linux
We take you inside the ultimate hacking
toolkit and explain how to use it in anger.
68 Data recovery
Recover files from damaged disks and
ensure deleted items are gone for good.
72 Key management
Learn how to create a good GnuPG key
and keep it safe from online thieves.
your real-world activity, the locations you visit and the We and our partners store or access information on devices, such as cookies and process personal data, such as
unique identifiers and standard information sent by a device for the purposes described betaw. You may ckk to
contacts you call or text. consent to our and our partners’ processing for such purposes Alternatively, you may cbck to refuse to consent, or
access more detailed information and change your preferences before consenting Your preferences will apply to
In addition to the well-known perils of cookies and this website only. Please note that some processing of your personal data may not requwe your consent, but you
have a nghr to object to such processing You can :hange your preferences at any time by returning to this site or
beacons, which track you across internet, there are the visit our privacy policy.
browser fingerprinters that use nefarious methods to REJECT ALL ACCEPT ALL
A
it
for decades. They create a
much better reading Home > Extensions > uBlock Origin Lite
72 open tabs.
Although it may appear
otherwise, adverts are not actually
on the site you visit in your browser.
The website provides a basic
HTML document that contains
instructions for formatting, locations
from which to retrieve images, and > UBlock Origin will struggle on with uBlock Origin Lite, which somehow still
how to fetch and display other manages to block ads while obeying the Google diktat. But for how long?
resources. Adverts are one such
resource and are pulled from a there’s no guarantee the maintainers won’t slip in some
remote location on kind of malware in future, or the project won’t be taken
the server of an advertising company. over by an evil villain. We’re not scaremongering, it
The URLs of these ad servers are generally well happens - most notably to the uBlock Origin fork Nano
known and have been compiled into dozens of lists Defender, which, after it was sold, incorporated a
that can be downloaded by you or your PC. forked connect.js file, which submitted user data and
When an ad-blocking extension is installed in a activity to remote servers. Extensions have also been
browser such as Google Chrome, resource requests used as trojans, viruses, keyloggers and other nasties.
are passed through the extension, which then retrieves Google’s big idea, first mooted in 2020, is part of its
the resource, which can be an image, advert or another so-called Privacy Sandbox model, which it says enables
page. If the URL is known to belong to an advertising “publishers and developers to keep online content
or tracking company, the advert isn’t fetched. Simples. free”, while enabling people to “enjoy their browsing
Except it’s not. Browser extensions are a risky and app experience without worrying about what
proposition at the best of times, and ones that have personal information is collected, and by whom”. All
access to all your web traffic have the potential to be very noble, we’re sure. Put simply, Google aims to
very dangerous indeed. Even if your go-to keep all user data within its own platform and offer
ad-blocker is ethically developed and open source, advertisers access to user metadata.
Currently, extensions for both Chrome and Firefox
based browsers are built around Google’s Manifest V2,
Ublock isn’t going which offers developers the option of using an
ephemeral background-based ora persistent
background page. Manifest V3 restricts what
If you’re a Chromium addict and can't get enough of Google products
extensions can do in Chrome by making them use
(unlikely, we think), it will still be possible to block ads on Chrome once
Manifest V2 is deprecated but it’ll be fiddly and limited. service workers - ephemeral, event-based JavaScripts
UBIock Origin Lite has been specifically developed with Manifest V3 that run in the background and don’t have access to
in mind and is fully compliant with Google’s new rules. the standard website API. They can’t execute code
According to the devs, "UBOL does not require broad read/modify and they can only run for a limited time.
data permission at install time, hence its limited capabilities out of the While extensions built on Manifest V2 can read
box compared to uBlock Origin or other content blockers requiring and modify your traffic (which is necessary for an
broad read/modify data permissions at install time,” and you need to ad-blocker to function) using the chrome.webrequest
explicitly grant extended permissions on specific sites. permission, Manifest V3 does away with this capability,
UBIcck Origin Lite is still a work in progress, and seems to be replacing it with chrome.declarativeNetRequest. This
effective so far, but it’s a sticking-plaster measure at best. permission can still modify your web traffic, but does it
blind - without ever seeing what that data is, and must
Migration guide
you any more, so it’s safe to allow adverts through. It
Describes how to get started updating Manifest V2 extensions so they work in works as a rationale, but it’s sure to annoy internet
Manifest V3.
Migration checklist
users everywhere.
Provides a quick checklist to help adapt your extension to Manifest V3.
I Manifest V3, but it's unclear how many will want to, Chromium itself - and all will be affected in some way
when Google completely disables Manifest V2 APIs in
declare, ahead of time, based on a very limited set of January 2023.
Google-defined rules. It stops extensions analysing One Chromium-based exception is Brave, which
individual requests, making most ad-blockers useless. doesn’t rely on extension APIs to block tracking and
Extensions won’t be able to load remote code either
- and all code must be approved by Google before the
extension is made available to users. Google’s motivation
This means you’re not going to fall victim to a dodgy
extension stealing your bank details or executing “It’s excruciatingly difficult to
arbitrary code to spoil your day, so, yes, it’s fair to say
that, in one way at least, Google is acting to protect
believe that Big G’s primary aim is
your security and privacy.
But if we’re being real for a second here, Google is a
to protect your privacy.”
surveillance advertising business - a phrase you have
doubtless read in these pages before and will again. ads, so ad-blocking should continue as normal. No
This means the more the company knows about guarantees, though - if Brave gains enough ground to
you, the more money it can make by targeting adverts thwart Google’s plans, Google may change the rules in
specifically to you. Its other businesses - Search, Maps, a way that harms Brave specifically.
Android, Gmail and Google Docs - are ancillary to this. A better option would be to use Mozilla’s Firefox
With that in mind, it’s excruciatingly difficult to believe instead, which has committed to supporting Manifest
that Big G’s primary aim is to protect your privacy. V2 indefinitely. This means that existing ad-blocking
extensions will still work and should continue to work
Why Google, why?! for ever.
We imagine that Google and its advertising businesses Firefox is currently the fourth most popular web
would have been quite happy doing business the way browser, boasting a 3.5% market share and coming in
they’ve always done it: matching people to their after Chrome (65%), Safari (18%) and Microsoft Edge,
interests and adverts accordingly. of all things (4%). Whether extension developers
Privacy organisations, including the Electronic consider it worth investing their blood, sweat and
Frontier Foundation and NOYB.EU, have been tears into such a small segment remains to be seen.
increasingly making angry noises at the way web
users are stalked through the internet jungle, like tom’sHARDWAI
hapless sightseers by a particularly hungry anaconda. I
The GDPR is one result of this and has resulted in
massive fines for dozens of corporations, including
Google, for failing to respect user privacy and data.
But campaigners in Europe would like to see more
safeguards in place - ideally, they would like no
tracking at all.
Ad-blockers have also become more competent
and ubiquitous in recent years. You don’t need to be
particularly technical to use one, and once it’s installed,
you can completely forget about it.
Google’s Privacy Sandbox is the company’s second
attempt to decouple individual users from the data it
collects while still maximising ad revenue. The first
effort, known as Federated Learning of Cohorts,
assigned individuals to a cohort that shared common
attributes and interests. Adverts would be served to > You wouldn't believe how many hoops we had to jump through to get a pic of
the cohort as a whole without the advertisers ever an ad on a website..
Firefox extensions
Let’s defend our browsing with some pointy plugins
that’ll keep the wolves at bay.
Explore my Pi-hole
In all of this panic about browser-based and checks URLs against lists of known where you can update the blocklists,
ad-blockers and Google’s extension ad servers. If a URL is on the list, the block new URLs on a one-off basis and,
shenanigans, we neglected to mention resource (usually an advert) isn’t loaded. if you're especially sneaky, monitor what
our own preferred solution. Although Pi-hole was designed with the your kids are doing online.
Pi-hole was built to run on a Pi in mind, it runs happily on most One huge advantage Pi-hole has over
Raspberry Pi. It can run happily on a Pi hardware built since the millennium. If the traditional extensions is that you can set
Zero and sit behind your couch, drawing only spare machine you have is a Windows it up so your entire network is covered -
less wattage than a solar-powered box, you can install it using WSL. this is a big deal if everyone in your
torch. Installation is simple and, once set up, house has at least one PC, a phone and
Sitting between your browser and the you can access Pi-hole’s admin a streaming device. You can save hours.
wider internet, it intercepts all requests functions through a web interface, Days even.
becomes obvious. And as for what badgers have to do block each tracker either just on the current page or
with anything, we don't know. across the entire web. Ghostery doesn’t use blacklists
and leaves decisions in your hands.
Privacy Possum Ghostery is also very focused on performance
Privacy Possum is based on the excellent Privacy and improving user experience - by default, it
Badger and was created by one of the engineers who blocks trackers that slow down the web and unblocks
worked on the project. It takes a completely different trackers if blocking them breaks the web page you’re
approach to preventing companies from following you. attempting to access.
Put simply, it doesn’t. To our mind, however, this isn’t ideal, because it could
Privacy Possum allows trackers to stalk you all they lead to a situation in which tracking companies
want - but they’ll never ever be able to get an accurate deliberately create trackers that break websites if they
idea of who it is they’re following. are notallowed.
It blocks cookies that let trackers uniquely identify
you across websites. It blocks refer headers that reveal The bottom line
your browsing location. It blocks etag tracking, which Each of these anti-tracking extensions focuses on a
leverages browser caching to uniquely identify you. different area. UBlock Origin is for people who hate
And it blocks browser fingerprinting, which tracks the adverts and hate tracking; Privacy Badger is all about
inherent uniqueness of your browser. heuristic learning and making sure that trackers behave
Without these unique identifiers, it doesn’t matter themselves; Privacy Possum would prefer that tracking
who is tracking you, they will never be able to link any of companies go bust; while Ghostery is about a fast, clean
the information, and better yet - it actually costs them user experience.
money without giving anything in return. Which extension you go for is up to you, depending
Browser fingerprinting - using the attributes of your on which model best suits your needs. We like them all.
browser such as installed fonts, screen resolution and Earlier, we mentioned in passing that extensions > Aww, look:
language packs - is also spoofed, rather than hidden. occasionally change ownership or are deliberately Ghostery has
tiny Pac-Man-
To use an analogy, if the tracking companies or compromised by their developers in order to make a
style ghosts
government agents on your tail are looking for a quick buck from users. We seriously doubt that the
to illustrate
short, blonde woman with tattoos, Privacy Possum creators of uBlock Origin, Privacy Possum, Privacy
its spooky
transforms you into a 6’ 5” skinhead bloke with a flat Badger or Ghostery are going to sell out, but we credentials. And
cap and a natty moustache. Then it turns you into can’t guarantee it. Make sure you check the GitHub there’s even an
something else instead. repositories regularly for any reported problems or emoticon of a
Why possums? Possibly because they pretend to be changes in contributors. frightened cat!
dead. The extension creator hasn’t said.
Ghostery
Sounds spooky, eh? We love that it conjures up
images of us coasting across the internet unseen and
undetected, like some child of an exotic phantasm -
especially as this feature was written in the run-up
to Halloween.
Ghostery advertises itself as enabling “cleaner,
faster, safer browsing", and as its mascot, it has a
friendly little spook.
In reality, Ghostery isn’t that much different from
the other blockers and offers you control on a tracker-
by-tracker basis from a handy and visually pleasing
dashboard, which lists all of the trackers on the page
you’re viewing or interacting with. From there, you can
between different routers so that Potentially, there are dozens of individuals who are
now aware that you secretly long for an overpriced,
they’re hard to track.” underperforming slab of shiny metal on your desktop.
If you use Tor, all information, including your IP
worse, to Disney copyright lawyers. Everybody loves address, is wrapped in multi-layered encryption and
getting paid twice, right? sent through a network of randomly selected relay
Commercial VPNs are designed with a very specific servers. Each of these relays only knows a small
threat model in mind, and for most people looking for section of the route and not the entire journey. The
a level of anonymity which would allow them to sneak final stop on this journey is known as the exit node
subversive messages past government censors, for and it’s the exit node that makes the final connection
> Connecting to
instance, the Tor Network is where it’s at. to http://9to5mac.com.
the Tor network
Tor was born in the 1990s as The Onion Routing All nodes are provided by organisations and
can be as easy
project, from the minds of engineers at the US Naval individuals who volunteer their bandwidth and
as pressing a
button. It may
Research Lab, who wanted a way of connecting resources to the cause of internet anonymity.
take you a computers on the internet without revealing the parties Routing messages through Tor can be done in a
few attempts, involved - even if someone is monitoring the network. variety of ways, including email plugins, but the most
though. It’s been instrumental in keeping communications common method is by using the Tor Browser, which is
built on Firefox - the most recent release is the alpha
version of Tor 12.
C ©tor Browser NotConnected £? O Vf —
Configure Connection... |
$ sudo apt install apt-transport-tor
...then add the following to /etc/apt/sources.list:
$ deb [signed-by=/usr/share/keyrings/tor-archive-keyring.
gpg] tor://apow7mjfryruh65chtdydfmqfpj5b
tws7nbocgtaovhvezgccyj azpqd.onion/torproject.org
<DISTRIBUTION> main
...for the stable version, or:
Kali Linux
Hack Wi-Fi, break things
We’re left wondering how the goddess Kali feels
about being associated with so many script kiddies?
efore we do anything, a standard other members of your household what original WPA has been deprecated, but is still
disclaimer: Do not use any of you're up to. much more secure than WEP). Cracking
these techniques against a With that out of the way. we can get on with wireless networks (not just WEP ones) isn’t
machine that’s not under your some introductory penetration testing. You just a matter of repeatedly trying to connect
control, unless you have been given explicit can use Kali straight from the disc, install it. or using different passwords as most routers
permission to do so. would blacklist the MAC
This guide could potentially address of any device that
be used to access things that “Do not use any of these tried that. Instead, a more
you're not supposed to, and if
you get caught (and, believe us,
techniques against a machine passive approach is required,
so we set our wireless adaptor
you will get caught if this guide that’s not under your control.” to a special mode where it
is your only source) you might silently sucks up all packets as
find yourself at the wrong end of the just install the tools (wiresharkand aircrack-ng they fly through the air, rather than sending
Computer Misuse Act, or whatever is the are available in most repos) on your preferred any of its own. Often called ‘monitor’ mode.
legislation in your locale. Even if it doesn't get Linux distribution (distro). For our first trick, We won't cover setting up a WEP network
to the courts, being woken up at 6am by law well show you how trivially easy it is to crack a here, you can do it with an old router or even
enforcement officers demanding that you WEP-secured wireless network. The on your current one, so long as everyone else
surrender all your hardware is no fun. Also if, underlying attacks used by aircrack-ngfirst in the household knows their network
for example, you're using Wireshark io collect came into being about 15 years ago. and activities are potentially all visible. Our
packets from your home wireless network, everyone should be usingWPA2 fortheir preferred solution is to set up a Raspberry Pi
then as a matter of course you should tell password-protected networks now (the running hostapd. the relevant hostapd.contig
Reggae Wireshark
As a pen tester, once you've got hold of a requests and acknowledgements.
wireless key there's no reason to stop However, we can tell Wireshark our key
there. Besides having access to any and these packets will surrender all of
resources on that wireless network you their secrets. Go to Edit > Preferences >
can also decrypt its traffic. Wireshark is a Protocols > IEEE 802.11 and tick the
great tool for capturing and viewing Enable decryption box. Click the ’Edit'
packets. You'll find it in Kali’s Sniffing & button next to Decryption Keys, and then
Spoofing menu, or you can install it on click on the'+' to add a new key. Ensure
any decent distro. We've already captured the type is set to WEP and enter the ASCII
a bunch of WEP-encrypted packets so codes of each character of the password,
lets have a look at those. Go to File > optionally separated by colons, eg our
Open and choose one of the output*.cap initial password short would be entered
files. Initially there's not much to see, 73:68:6f:72:74 . Once you leave the
most packets will just be listed as Preferences dialog, all the packets will
amorphous IEEE 80211 data, and there have been delightfully colour coded, all
will be some other boring network sources and destinations revealed.
“For fun and games why you can probably fathom, it features
somewhat underwhelming security. This is
Secu re
chat
While not particularly paranoid, we wouldn't want anyone to eavesdrop on our
playful banter about the Great British Bake Off with our mates.
How we tested...
We'll look at each instant messager's
mechanisms for enhancing security
and privacy, and whether any of
these has a negative effect on the
usability of the application.
We'll also keep an eye out for
applications that are cumbersome
to use and ruin the user experience
in their efforts to ensure privacy.
Some users that are exchanging
sensitive information probably won't
mind taking a hit on usability if it
ensures stronger privacy, but the
majority are unlikely to want to jump
through too many extra hoops.
We'll also keep an eye out for I Ms
that offer the same convenience and
features as their popular
counterparts. On a related note, an
IM's repository and its supported
platforms can be a key deciding
factor. Similarly, you can't get
anyone to switch to a new app if the
installation is long and drawn out.
ver the years, instant In their bid to outdo the competition, be subpoenaed. So while IM clients and
Security protocols
How do they secure the transmission?
he main reason for using these GoldBug uses end-to-end
User experience
Does it make instant messaging easy to use?
ll applications, and not just the ones in messages to your buddies. Since there's a interface will go a long way in getting your
CryptoCat ★★★★★
If it didn't insist on setting up a 12-character long password, CryptoCat
would feel just like any other IM client. When you sign in for the first time.
CryptoCat will generate encryption keys and store them on your new
device. It II do this every time you log into your account from a new
device. Each device has a unique fingerprint that you can verify with your
buddies. Once verified a device you can mark it as trusted.
For additional security, you can ask CryptoCat to send messages
only to trusted devices. When receiving messages. Cryptocat will always
show you which device your buddy used to send that message and
inform you whenever your buddy adds a new device. The IM window is
the standard fare and includes buttons to record and send minute long
video messages and files.
Goldbug ★
On the first launch, you'll be asked to create authentication information
and the application generates eight sets of encryption key pairs each for
a different task, such as messaging and emailing etc. Once the keys
have been generated, you'll have to enable the kernel using the 'Activate'
button. You can now connect to a chat server or the echo network and
add your friends.
Initially, the project adds its own chat server as a neighbour but this
is strictly for testing purposes only, and you'll have to exchange keys
with your friends before you can chat. Besides the option to import and
export public keys, Goldbugoffers an interesting option called Repleo
which enables you to export your public key after encrypting it with a
friend’s already imported key. Despite its uniqueness, Goldbughas one
of the most confusing interfaces and its workflow is the least intuitive.
Ease of installation
Is it newbie-proof? Verdict
CryptoCat
ruth be told, there aren’t many which severely limits who can actually builds as both Deb and RPM for all the ★ ★★★★
Retroshare ★★★
Retroshare looks very different to a traditional IM client. On first launch,
it looks rather bare and none of the tabs at the top list any content.
That’s because Retrosharefetches these from your friends, so you'll
have to view any content on the Retroshare network.
You can add friends directly by sharing your keys privately or you can
exchange your keys with a chat server. You'll need to head to the chat
lobbies and look up 'Chatserver EN' to join the chat, say hello and paste
your key. To friend someone,you must exchange keys. You’ll have access
to all the forums, downloads and channels that your friends are
subscribed to. Note: It will take a few hours before you get all forums and
channels from your friends.
qTox ★★★★
Like CryptoCat, the user interface of qTox resembles that of a traditional
IM client. You'll be asked to create a new profile when you first launch
the application. You can then add new contacts using one of two
methods: either by sending your Tox ID via secure means, such as
encrypted email, or, if your friends are using a Tox mobile client, you can
send them a copy of the QR code image generated by your client.
Once you're connected, you can interact as you would using a
normal IM client except for the fact that your conversation isn't flowing
through a central server. The chat window also has buttons to initiate
audio and video calls. You also get buttons to create chat groups and
send files, and there’s an option to capture and send screenshots.
Platform support
Can they be used on mobile and other platforms?
hile you can convince your Raspberry Pi. Jitsialso has installers for
W buddies to move to a
different IM client with better
Extra features
What more can they do besides IM and video?
W themselves as instant
messengers some of them
can do a lot more than send simple
messages. Most of them enable you to
enables you to stream either the entire
desktop or a portion of the screen.
can even enable your contact to
Youtext
remotely control your desktop.
have encrypted voice and video calls Moreover, users at both ends of a call
and can also send files over the can share their desktops with the other
encrypted channels. person at the same time. The
However, there's not much more application also has a number of
you can do with CryptoCatthan enterprise-friendly features, such as
exchange encrypted text messages and support for LDAP directories.
securely transfer files. qToxfares a little Goldbugand Retroshare stand apart > Goldbug has additional encryption
better, its desktop users can also host from the others in that they are much tools, such as the Rosetta Cryptopad
group chats with other users. The larger platforms for secure which is an alternate to GPG and can Verdict
application also supports ToxDNS communication and enable you to encrypt any text for transport via
traditional unsecured mediums. CryptoCat
which is used to shorten regular Tox IDs interact with your friends in several ★
into memorable IDs that resemble an different ways. Both, for example, Goldbug
email address, and the client includes include an email system that takes ★★★★
Jitsi
screen-capturing capabilities to help advantage of their respective peers to boards as well as a public notice board
★ ★★
you quickly share snapshots. store and exchange encrypted where you can paste links, vote and
qTox
Jitsi is a full-fledged softphone that messages. Goldbug can also be used to discuss topics in a similar way to Reddit, ★★
can mute, put on hold, transfer and send encrypted emails over traditional (but perhaps without as much snark). Retroshare
record calls. It can also make registrar POP3 and IMAP services. You can also Then there's the Channels section ★★★★★
less SIP calls to other Jitsiusers on the use it to have discussions over where you can publish your files. » Goldbug and
RetroShare can
local network. One of Jitsis unique encrypted public IRC channels in which You can also subscribe to any of the
send encrypted
features is its ability to stream and each chat room is defined with a listed channels, much like RSS feeds, to emails without a
share your desktop without using any magnet link. In addition to email, automatically download the latest mail server.
of the traditional desktop streaming Retroshare offers decentralised forum published files.
The verdict
ll the instant messengers in the together cover all the major desktop
It's tough to recommend one over ffetroS/iarewhich walks the fine line
the other so we'll rate them by the between function and usability. The communicates via a central server, but
Holmesian method of elimination. application and the network are both Jitsi provides good options to encrypt
Goldbug is the first to get the axe feature-rich and don't take too much to sessions and prevent snooping. Also
because of its confusing Ul and steep acclimatise to. We were impressed by setting up a central server on your
learning curve. Next up is CryptoCat RetroShares personalisation of the premises doesn't take too much effort.
which is intuitive but only secures text peer-to-peer model into a friend-to- Better still, you can use Jitsis registrar
based communications. Then there's friend network that’s totally off the grid. less SIP feature to make secure
qTox which ticks all the checkboxes to But it's a drastic change for any encrypted calls to users on the local
take the top spot. For starters, it isn't all friends you want to communicate with, network out of the box.
that different from a traditional IM client so we've rewarded
and is equipped with all the security
and privacy features you'd expect from which findsthe
“We
e
’ve awarded the top spot to
a secure client. You can use qTox to right balance Jitsi, which finds the right balance
make audio and video calls and it plays between form and i . r ir ••
well with other Tox clients which function, ycs it between form and function. ”
Also consider...
Having secure conversations over the insecure can use to encrypt your chats, for example systems, but if you need a secure app for
open internet is a growing concern for Pidgin is one such mainstream client that mobile-to-mobile communication, check out
corporations and individuals alike. This is why comes with OTR as an optional plugin. ChatSecure. Signal and SureSpot. They are all
in addition to the open source clients we’ve There's also Wickr which allows users to open source and available for both Android
covered in this Roundup, there are a wide array exchange end-to-end encrypted messages and and iOS devices. While ChatSecure only allows
of proprietary clients on offer as well. There's a enables them to set an expiration time on the text-based OTR encryption over XMPP, you
strong possibility that your current IM client communication. The application is available for can use Signal and SureSpot to make audio
enables you to add the OTR plugin, which you all major mobile and desktop operating and video calls as well. ■
Linux: Secure
your desktop
Linux can thwart a majority of attacks on its own but we can help put a level
10 forcefield around your computer.
unning Linux just because you think it's safer than you decided to disable a service on which they rely. For
viruses and worms written for Windows, but attackers have Secure user accounts
several other tricks up their sleeves to illegally access your On a multiuser system like Linux, it's imperative that you limit
precious bits and bytes that make up everything from your access to the superuser root account. Most distributions
personal emails to your credit card details. these days don't allow you to login as root at boot time, which
Locking your data behind a username and password is good. Furthermore, instead of giving multiple people root
shouldn't be your only line of defence and isn't enough to permission, you should grant root access on a per-command
hold off a determined attacker. As the number, nature and basis with the sudo command. Using sudo instead of logging
variety of computer attacks escalate every day, you too in as the root user has several advantages. All actions
should go out of the way and take ext'a measures to secure performed with sudo are logged in the /var/log/secure file,
your computer against unauthorised access. which also records all failed attempts.
All mainstream Linux distributions such as Debian, One of the major advantage of using sudo is that it allows
Ubuntu, and Fedora have security teams that work with the you to restrict root access to certain commands. For this you
package teams to make sure you stay on top of any security need to make changes in the /etc/sudoers file which should
vulnerabilities. Generally these teams work with each other to always be edited with the visudo command. The visudo
make sure that security patches are available as soon as a command locks the sudoers file, saves edits to a temporary
vulnerability is discovered. Your distribution will have a file, and ensure the configuration is correct before writing it to
repository solely dedicated to security updates. All you have /etc/sudoers. The default editor for visudo is vi.
to do is make sure the security-specific repository is enabled To allow a user named admin to gain full root privileges
(chances are it will be, by default), and choose whether you'd when they precedes a command with sudo, add the following
like to install the updates automatically or manually at the line in the /etc/sudoers file:
press of a button. For example, from the Updates tab in the admin ALL=(ALL) ALL
Software & Updates app, you can ask Ubuntu to download To allow a user named joe to run all commands as any
and install security updates automatically. user but only on the machine whose hostname is viperhost:
In addition to the updates, distributions also have a joe viperhost=(ALL) ALL
security mailing list to announce vulnerabilities, and also You can also restrict access to certain commands. For
share packages to fix them. It's generally a good idea to example, the following line will only allow user called susie to
keep an eye on the security list for your distro, and look out run the kill, shutdown, halt and reboot commands:
for any security updates to packages that are critical to you. susie ALL = /binAdll, /sbin/shutdown, /sbin/halt, /sbin/
There's a small lag between the announcement and the reboot
package being pushed to the repository; the security mailing Similarly, user called jack can only add and remove users:
lists guide the impatient on how to grab and install the jack ALL = /usr/sbin/adduser
updates manually. You can also restrict a user’s scope. The following allows
You should also take some time to disable unnecessary the user named nate to kill unresponsive processes, but only
services. A Linux desktop distro starts a number of services on his workstation named tango and not anywhere else:
to be of use to as many people as possible. But you really nate tango = KILL
don't need all these services. Samba, for example, shouldn't On a related note, you should also set expiration dates for
really be enabled on a secure server, and why would you accounts used by non-permanent users. This can include any
need the Bluetooth service to connect to Bluetooth devices interns, temporary employees and consultants who need to
on a computer that doesn’t have a Bluetooth adapter? All access your Linux installation. Ideally you should immediately
distributions let you control the services that run on your deactivate and remove the temporary accounts as soon as
Linux installation usually with an built in graphical utility. they aren’t needed. The expiration date acts as a safeguard to
However some applications might stop functioning because ensure these accounts can’t be misused.
Prevent browser Q Open permissions menu when mouse hovers over NoScript\'s icon
based breaches with the Left clicking on NoScript toolbar button toggles permissions for current top-level site
NoScript and BetterPrivacy (ctrl+shift+BACK SLASH)
extensions that prevent Full Addresses (http://www.noscript.net)
your web browser from Full Domains (www.noscript.net )
running malicious scripts. • Base 2nd level Domains (noscript.net)
Q Automatically reload affected pages when permissions change
Use the usermodcommand to tweak a user's account and You can view the permissions of a file or directory with the
set an expiration date, such as: Is -1 command. The command to use when modifying
$ sudo usermod -e 2017-01-02 bodhi permissions is chmod. There are two ways to modify
In this example, the user named bodhi will not be able to permissions, with numbers or with letters. Using letters is From a security
point of view, it's
log into the account from January 2.2017. easier to understand for most people, but numbers are much
prudent to stick
better once you get used to them. Table 1 (over the page) lists to the official
Permissions primer the chmod values for each of the permission types. repositories as
Another important part of securing your Linux system is For example, chmod u+x somefile gives execute much as possible,
setting proper permissions. In Linux and Unix, everything is a permissions to the owner of the file. The chmod 744 somefile and only look
elsewhere as a
file. Directories are files, files are files and devices are files. does the same thing but is expressed in numbers. Similarly,
last resort.
Every file and program must be owned by a user. Each user chmod g+wx somefile adds write and execute permission to
has a unique identifier called a user ID (UID), and each user the group while chmod 764 somefile is how you'll express it
must also belong to at least one group, which is defined as a with numbers.
collection of users that has been established by the system However, this arrangement can't be used to define per
administrator and can be assigned to files, folders and more. user or per-group permissions. For that, you need to employ
Users may belong to multiple groups. Like users, groups access control lists (ACL) that enable you to specify elaborate
also have unique identifiers, called group IDs (GIDs). The permissions for multiple users and groups. While you can
accessibility of a file or program is based on its UIDs and define them manually, graphical tools such as E/c/e/make the
GIDs. Users can access only what they own or have been process more intuitive and help you save a lot of time and
given permission to run. Permission is granted because the effort. You can install E/c/e/from the repos of most major
user either belongs to the file's group or because the file is desktop distributions. Once installed, the tool can be used to
accessible to all users. The one exception is the root or fine-tune the access permissions for each individual file.
superuser who is allowed to access all files and programs in To get a better hang of the filesystem permissions on
the system. Also, files in Linux have three kinds of permission Linux, let's put them into practise to lock sensitive files such
associated to them - users, groups and others - that as the ones that house password information. The file should
determine whether a user can read, write or execute a file. belong to the root owner and group with 644 permissions.
use these to encrypt the containers. The app also includes will allow traffic without asking any questions. The Deny
the zuluMount tool that can mount all encrypted volumes option will silently discard all incoming or outgoing packets.
supported by zuluCrypt. The Reject option is different in that it sends an error packet
To install zuluCrypt head to http://mhogomchungu. to the sender of the incoming packets.
github.io/zuluCrypt/ and scroll down the page to the binary After you've set the policy for both Incoming and Outgoing Use the change
packages section. The app is available as installable .deb traffic you can define specific rules for individual apps and command
package files for Debian and Ubuntu. Download the package services. To create a rule, click the Add button after expanding (change -1
bodhi) to get
for your distro and extract it with tar xf zuluCrypt*.tar.xz . the Rules section. This opens a window that offers three tabs
various details
Inside the extracted folder, switch to the folder corresponding that enable the creation of rules in different ways. The
about a user's
to your architecture (i386 for older 32-Bit machines and Preconfigured option lets you select ready made rules for account, including
amd64 for new 64-Bit ones). Both folders contain four binary specific apps or services, while the other two enable you to the account expiry
packages that you can install in one go with the sudo dpkg -i define rules for specific ports. date and time
since the password
‘deb command. On other distributions you'll have to install We'd suggest that most users should stick to the
last changed.
zuluCrypt manually. Download the app’s tarball and follow the Preconfigured tab. All you need to do is select the app you
detailed steps in the included BUILD-INSTRUCTIONS file to wish to control traffic for from the drop-down menu and the
fetch the dependencies from your distro's repos. app will automatically define the most effective rules. As
mentioned earlier: for a secure system, you should drop all
Put up a Firewall incoming and outgoing traffic and then selectively add rules
Linux distributions comes with the venerable netfliter/ for the apps and services that you use. such as the web
iptables framework. This framework is a set of kernel browser, instant messaging and BitTorrent etc. ■
modules that can be utilised to create packet filtering rules at
the kernel level. Ubuntu ships with an application called Table 1. Access and user restrictions
Uncomplicated FireWall(UFW) which is a userspace
Permission Action chmod option
application that can be used to create iptables rules. There is
also a GUI for UFW called Gufw. Gufwtakes the pain out of read (view) ror4
managing iptables. The program can easily allow or block
write (edit) wor2
services as well as user-specified ports. You configure
your policy based on pre-installed profiles for Home, Public execute (execute) xorl
and Office and set the policies for incoming and outgoing
traffic. The default configuration should satisfy most of the
User Is -1 output chmod option
users, you can set individual rules if you wish for a more
advanced configuration. owner -rwx...... u
Begin by first enabling the firewall. Once enabled you can —. rwx—
group g
set the Incoming and Outgoing policies by selecting one of
other ...... -rwx 0
the three options in the drop-down menus. The allow option
https://commons.wikimedia.0rg/wiki/Fi1le:SanDtsk_
inconvenience to financial hardship.
And as we’re all well aware, there can
[expert
Fij$ion_ioMemory_PX600-5200_PCI-
Mike Bedford into the wrong hands. Here we address the two
has been the victim
inter-related themes of data recovery following
of a disk crash, so
is all too aware of accidental deletion or hard disk failure, and secure
deletion so that, when you do delete data, nobody else > SSDs look different from
the anguish of losing
important data. magnetic hard disks and the
can recover it. Mostly we're considering traditional
challenges they pose for file
magnetic hard disks, but we also look at the different
recovery and secure deletion
challenges that apply to SSDs (see Solid-State Drives
are markedly different, too.
boxout below).
Check your bin! the trivially simple method of recovering the file won’t
Sometimes the obvious gets overlooked: that obvious work. If the file was deleted in the file manager - as will
measure is to restore the file from the Rubbish Bin almost certainly be the case with your non-technically
(Trash if the language is set to American English), the minded friend - there’s a good chance it’s residing in
special folder that stores files that have been deleted. the Rubbish Bin. Certainly, that is what happens if you
Do bear it in mind. After all, magically restoring your select a file and hit the Delete key, although Shift*
friend’s files might just promote you to hero status. If Delete bypasses the Rubbish Bin. It’s also possible,
you deleted a file using the rm (remove) command in permissions depending, to delete a file or send it to the
the terminal, that file will have been genuinely deleted, Rubbish Bin by selecting the appropriate option having
as opposed to being dispatched to the Rubbish Bin, so right-clicked on a file.
Solid-State Drives
Most of the techniques discussed an SSD can’t just be overwritten. First it has Then there’s wear levelling. Because
throughout this article don’t apply to SSDs, to be erased, which is a function of the flash memory can’t be written to as many
and both recovering deleted files and secure memory chips, and is not the same as times as magnetic memory -1,000 to
deletion are either impossible, unnecessary overwriting with zeros, for example. This 100,000 times, depending on the tech - the
or they are significantly more difficult takes time, so the SSD erases unused space SSD moves blocks of data around, as a
because of several things that happen, as a background process, so that writing background process, to avoid any blocks of
internal to the SSD, that the PC is totally new files isn’t slowed down unnecessarily. It memory' being over-used. Although the
unaware of. probably won’t happen immediately, but SSD’s firmware keeps track of this, it doesn’t
The first concerns what happens when a when the data is eventually erased, there’s provide the PC with this information. So,
file is deleted, and it relates to how the no possibility of recovering the file. That’s even if parts of a deleted file haven’t yet
space it occupied will eventually be reused. the bad news; the good news is that secure been erased, file recovery software won’t
Unlike a magnetic disk, the flash memory in deletion isn’t necessary. know where, the remnants of the file are.
be used by that third party to resurrect your deleted with folders, although interestingly, in the light of our
data. Probably of more concern is being able to safely previous discussion, it overwrites data with just a single
dispose of an old PC. If the content of any deleted files pass, favouring speed over unnecessary multiple
is sensitive, therefore, you’ll want to take every means passes. As a major step beyond shred, BleachBit also
possible to ensure that it can’t be recovered. overwrites all unused space on your disk. This means
We started this article with the obvious, and the that it can securely delete files that have already been
subject of the Rubbish Bin is equally relevant here. deleted, something that shred can’t do. Bear in mind,
If you want to make sure your deleted files stay that though, that this isn’t a quick process. In addition,
way, don’t just transfer them to the Rubbish Bin. As BleachBit offers the option of removing a whole load of
we know, that alone isn’t enough to prevent them from files that you haven’t specifically written yourself - for
making a comeback, and this brings us to the subject of example, temporary files or browsing history, which
secure deletion. Deleting a file ordinarily doesn't delete might contain sensitive information. You can, of course,
it, but secure deletion utilities do exactly that delete this sort off data elsewhere - for example,
> BleachBit
by overwriting the entire contents of that file with other you can delete browsing history in the browser - but
offers secure
data. Using the command shred in place of rm BleachBit offers a couple of advantages. First, it’s a
deletion of files,
overwrites the file, and if you use the -u flag, it deletes one-stop shop ,so you can manage all your temporary
overwriting
it afterwards. By default, it overwrites the file three file deletion requirements from a single place. And,
of unused disk
times with random data, although you can increase on top of that, unsurprisingly, BleachBit can not only space and a
this using the -n flag. That’s surely enough, in fact you delete this unwanted data, but it can do so securely. whole lot more.
might think it’s more than enough, which raises the
question of why it overwrites the data multiple times. In
fact, it also takes us into the strange world of secure Q. Preview Clean Abort BleachBit
deletion utilities trying to outdo each other in how
v APT
many times the data is overwritten and how. Delete l.7MB/home/mike/Photos/P607992l.jpg
autodean
The commonly cited answer lies in the fact that, Delete l.7MB/home/mike/Photos/P6079922.jpg
autoremove Delete 1,8MB /home/mike/Photos/P6079924.jpg
when a bit is overwritten on a magnetic disk, it’s dean Delete 1.6MB/home/mike/Photos/P6089943.jpg
because it’s designed to output just Os and Is, not the Form history
Passwords
analogue value of the magnetism. Instead, you’d need
to transfer the disk platter to some specialist and very
expensive hardware, which takes us from the realm of
GnuPG: Key
Management
Your GnuPG key is your precious. We explain how to create a good one
and how to keep it safe from online thieves.
Index | Status pages | Overview of pools | Interact with the keyservers | HTTPS Verification | #Key development | Contact |
of public keyservers
Extract a Key from the Server
with an interactive
web interface where Submit a Key to the Server
you can upload your
key or search for other
people’s.
Extracting a Key
Here is how to extract a key:
1. Select either the "Index" or "Verbose Index" check box. The "Verbose Index" option also
displays all signatures on displayed keys.
2. Type ID you want to search for in the "Search String" box.
nuPG. the ''Gnu Privacy Guard”, is a privacy tool you keys, possibly obtaining a certificate from a key server, along
personal-cipher-preferences AES256 AES192 AES CAST5 such cases where a key cannot be revoked it is of some
personal-digest-preferences SHA512 SHA384 SHA256 comfort to know that it will expire at some point. Should the
SHA224 worst not happen, the expiry date can be changed, even if the
cert-digest-algo SHA512 key has already expired. Note that expired keys can still
The haveged
default-preference-list SHA512 SHA384 SHA256 SHA22 decrypt already encrypted messages.
(www.issihosts.
AES256 AES192 AES CASTS ZLLB BZIP2 ZIP The example parameter file includes the passphrase but com/haveged)
Uncompressed gpg will prompt for it interactively if it is omitted from the file. utility can help
This configuration example sets the default key server Other options may be given, such as "preferences" which providetheentropy
required for key
from where public key certificates can be obtained and states would override the default preference list in gpg.conf.
generation. Check
preferred cipher and digest (hashing) algorithms. The default The user id consists of the given name ("Name-Real"), yourdistro's
preference-list defines those preferences that will be included email ("Name-Email") and an optional comment ("Name- packagerepository.
when generating new keys so that third parties using them Comment”) that we didn't use. Popular opinion in the PGP
know what we would prefer them to use. Together, these community recommends against using comments because
preferences control the available algorithms that GnuPG may they are not part of your identity. Bear in mind that you can't
use and, as an example, we express our preference for more change a user id but you can revoke them and add new ones.
secure ones. The default algorithms, however, are suitable for
most use-cases should you prefer to stick with them. And the key is...
The easiest way to create a key is to enter gpg -gen-key Once key generation completes, gpgcan display a summary
and follow the prompts that request name, email address and of what was produced with its -list-keys (or -k) command:
a passphrase. This method uses default settings (including $ gpg -k alice
those from the configuration file) and would produce a non pub rsa4096 2016-10-03 [SC] [expires: 2017-10-03]
expiring 2048-bit "primary", or “master", RSA key for signing 109FB60CAD48C7820CF441A661EB6F7F34CE2E54
and certification, a user id formed from the given name and uid [ultimate] Alice <alice®example.org>
email, and a subkey (also 2048-bit RSA) for encryption. sub rsa4096 2016-10-03 [E] [expires: 2017-10-03]
Another approach is to use GnuPG's batch mode because This shows three things: a 4096-bit primary key, the user
it allows the required information to be provided in a id and a subkey. The [ultimate] annotation on the user id You can add
parameter file instead of prompting for it to be entered reflects trust in yourself (it's your key) and means your key is frequently used
interactively. The parameter file allows more detailed valid and you will trust any other keys you sign with it. formatting options
to gpg.conf. Just
configuration than the interactive tool and also serves as a The long string of hexadecimal characters is the primary
leaveofftheleading
record of the parameters used to generate the key. key's “fingerprint", a 160-bit SHA1 hash of the key material. double-hyphen.
$ cat «EOF > alice.keyparams The pub prefix to the primary key tells you that you're looking
Key-Type: RSA at the public key; the sub prefix conveys similar meaning for
Key-Length: 4096 the subkey. The two corresponding private keys aren't listed,
Key-Usage: sign but also exist in the newly created key ring (that is stored
Subkey-Type: RSA within the -/.gnupg directory). Use gpg -list-secret-keys (or
Subkey-Length: 4096 its short-form -K) to list them (see over): »
Subkey-Usage: encrypt
# Each basel6 line ends with a CRC-24 of that line.
Name-Real: Alice # The entire block of data ends with a CRC-24 of the entire block of data.
Name-Email: alice®example.org
1: 06 04 58 El AD EB 60 FB 8F 9F 19 B5 58 6F 50 D8 F0 AC Cl 4C CC 8F 851363
Passphrase: alicel234 2: 02 89 FE 07 03 02 3C 61 CE EC 6A 4B E6 A4 00 A4 AE Fl 4F 52 27 EE 2AA7E2
Expire-Date: ly 3: AB A6 1A 66 0D 20 BC 94 14 CB 8F 72 5E EC 7B E4 7B CA 8F 69 4C A8 73932D
4: 86 7B 7F 54 8D 25 21 92 2F C6 91 01 9D A5 C6 B6 28 FC 3F 35 42 85 961B5E
EOF 5: 48 CE OB 6F 99 F2 7F 95 CC 35 24 8C 40 4E 3D Cl IF 48 86 AD 95 AB 4822BC
$ gpg -verbose -gen-key -batch alice.keyparams 6: BA 68 9D 0A B8 FB F9 El 39 08 8B 77 Al C0 7C 0E 4C 9C 08 EF 9E 66 56FF4E
7: 6E 30 18 01 C7 E4 BO 00 68 4E 57 94 DO 9B A5 F4 14 35 BO 57 B0 08 384123
The key generation may take a little while because it 8: 91 EB 09 65 DA 4D 91 06 08 65 00 72 4B EC 19 E8 46 82 F8 2A E5 07 19E80F
requires "entropy" to provide sufficient random data: the 9: 48 8F F8 DA 13 57 13 FD DA 40 43 El AA 5C 04 C6 77 5E AA EC 6F F9 A0843E
10: CF 8A 03 63 56 7E B5 78 D5 23 31 AD FF 3C AF 7C 7E CE 4E 74 6F IB 075060
verbose option asks gpgfor progress feedback. 11: EF C7 CD 93 11 FA 25 02 FC 2C 64 51 CE E8 F5 EA 13 10 Bl 92 3A 57 0AD2DD
Our example generates larger 4096-bit keys (just to 12: 9F D7 2E IB 66 61 31 0D DA B8 43 A2 8E 43 D6 29 IB 56 95 A5 E7 F8 518912
13: 79 8D BE El 5B 54 80 5C 79 0A 75 EC 22 87 BA 15 DC 2C 98 C3 9B 8F C77B86
illustrate the capability. 2048-bit keys are secure for most 14: CE EC B8 57 BB A9 7D 46 89 E2 DA Bl E0 54 8A C4 16 67 5F FB 7C D7 FA35F9
purposes) that will expire one year after creation. An expired 15: 86 IE 07 F5 87 E8 4C 9E 9B 78 98 18 43 E8 D6 8F 89 8E AA 17 AD FB 6ADADE
16: 0B AC A0 2D 4A 13 43 A7 74 IE FA 33 39 12 BC E5 75 CB D8 90 Al 22 D5765C
key is invalid and cannot be used to sign or encrypt, and 17: 85 93 94 7A 16 D5 FB 7C E6 A9 A7 E6 99 82 4C 85 Fl C4 0B C6 3F 8B 01E32A
setting a date when this should occur is a precautionary 18: 73 96 AC 56 6F F8 26 70 40 A8 C5 CB A2 2E 0D 16 7F 72 86 42 72 B7 4373F5
19: 0A 86 CA CD 66 26 16 29 41 9D 54 32 41 63 CD 34 50 FD DF 40 40 9D A83422
measure that doesn't hurt but would be beneficial in the
event that the private key or its passphrase were ever lost. In > Paperkey's output can be used to recover your secret key.
Cross certification
There is a vulnerability where a public subkey primary key to prove their authenticity. These signing subkeys generated with these
could be attached to another certificate whose “back" or "binding” signatures are embedded applications may lack the required binding
owner could then claim to have signed a within the self-certification signatures that signatures. Owners of such keys can resolve this
document. To prevent such a scenario occurring. GnuPG adds to the signing subkeys - you can't with the cross-certify command available in the
GnuPG now checks that signing keys are cross see them with -list-sigs. key editing mode of the latest gpg.
certified before verifying signatures. Cross Older versions of GnuPG or other OpenPGP You can read the official explanation at www.
certification requires that subkeys sign the applications may not have this feature and gnupg.org/faq/subkey-cross-certify.html.
fl B
fl ■■■■ fl Lmm
ite_attributes(params[:task]) format.html fl flsl^B oB ■ fl^lse format.html {render action: “edit”} format.json {rei
:ec rails generate migration add_priority_to_tasks priority integer $ bundle exec rake db:migrate $ bundle exec rake db:migrate $ bundle exec rails server validate
at, ‘is in the past!’) if due_at < Time.zone.now #!/usr/bin/en python import pygame from random import randrange MAXJSTARS = 100 pygame.init() screen = py
ars = for i in range(MAX_STARS): star = [randrange(0,639), randiange(0,479), randrange(l, 16)] stars.append(star) while True: clock.tick(30) for event in pygame.
numstars = 100; use Time::HiRes qw(usleep); use Curses; $screen = new Curses; noecho; curs_set(0); for ($i = 0; $i < $numstars ; $i++) {$star_x[$i] = rand(80); $s
clear; for ($i = 0; $i < Snumstars ; $i++) {$star_x[$i] — $star_s[$i]; if ($star_x($i] < 0) {$star_x[$i] = 80;} $screen->addch($star_y[$i], $star_x[$i], “.”);} $screen->refre
rent, lest do gem “rspec-rails”, “~> 2.13.0” $ gem install bundle: $ gem install rails -version=3.2.12 $ rbenv rehash $ rails new todolist -skip-test-unit respond
nl {redirect_to ©task, notice: *...’} format.json {head :no_content} else format.html {render action: “edit”} format.json {render json: @task.errors, status: :unprc
ity_to_tasks priority integer $ bundle exec rake db:migrate $ bundle exec rake db:migrate $ bundle exec rails server validate :due_at_is_in_the_past def due_at_is_
jne.now #!/usr/bin/en python import pygame from random import randrange MAXJSTARS = 100 pygame.init() screen = pygame.display.set_mode((640, 480)) c
star = [randrange(0, 639), randrange(0, 479), randrange(l, 16)] stars.append(star) while True: clock.tick(30) for event in pygame.event.get(): if event.type = pyg
tes qw(usleep); use Curses; Sscreen = new Curses; noecho; curs_set(0); for ($i = 0; $i < Snumstars ; $i++) {$star_x[$i] = rand(80); $star_y($i] = rand(24); $star_s[$i]
s ; $i++) { $star_x[$i] ■= $star_s[$i]; if ($star_x($i] < 0) { $star_x($i] = 80;} $screen->addch($star_y[$i], $star_x($i], “.”);} $screen->refresh; usleep 50000; gem “then
Is”, 2.13.0” $ gem install bundler $ gem install rails -version=3.2.12 $ rbenv rehash $ rails new todolist -skip-test-unit respond_to do Iformatl if ©task.update_
’} format.json {head :no_content} else format.html {render action: “edit”} format.json {render json: ©taskerrors, status: :unprocessable_entity} $ bundle exec rails
exec rake db:migrate $ bundle exec rake db:migrate $ bundle exec rails server validate :due_at_is_in_thejpast def due_at_is_in_the_past errors.add(:due_at, ‘is in tl
rgame from random import randrange MAXJSTARS = 100 pygame.init() screen = pygame.display.set_mode((640, 480)) clock = pygame.time.Clock() stars = :
2(0, 479), randrange(l, 16)] stars.append(star) while True: clock.tick(30) for event in pygame.event.get(): if event.type = pygame.QUIT: exit(O) #!/usr/bin/perl $m
: new Curses; noecho: curs_set(0); for ($i = 0; $i < Snumstars ; $i++) { $star_x($i] = rand(80); $star_y[$i] = rand(24); $star_s[$i] = rand(4) + 1;} while (1) { Sscreen-
]; if ($star_x($i] < °) { $star_x[$i] = 80;} $screen->addch($star_y[$i], $star_x[$i], “.”);} $screen->refresh; usleep 50000; gem “therubyracer”, “~> 0.11.4” group :de-\
ndler $ gem install rails -version=3.2.12 $ rbenv rehash $ rails new todolist --skip-test-unit respond_to do Iformatl if @task.update_attributes(params[:task]) forma'
nt} else format.html {render action: “edit”} format.json {render json: @task.errors, status: :unprocessable_entity} $ bundle exec rails generate migration add_priorii
exec rake db:migrate S bundle exec rails server validate :due_at_is_in_the_past def due_at_is_in_the_past errors.add(:due_at, ‘is in the past!’) if due_at < Time.zon
ndrange MAXJSTARS = 100 pygame.init() screen = pygame.display.set_mode((640, 480)) clock = pygame.time.Clock() stars = for i in range(MAXJSTARS): star =
snd(star) while True: clock.tick(30) for event in pygame.event.get(): if event.type = pygame.QUIT: exit(O) #!/usr/bin/perl Snumstars = 100; use Time::HiRes qw(us
($i = 0; $i < $numstars ; $i++) { $star_x($i] = rand(80); $star_y[$i] = rand(24); $star_s[$i] = rand(4) + 1;} while (1) { $screen->clear; for ($i = 0; $i < Snumstars ; $i++)
reen->addch($star_y{Si], $star_x[$i], “.”);} $screen->refresh; usleep 50000; gem “therubyracer”, “~> 0.11.4” group development, itest do gem “rspec-rails”, “~> 2.13.0
Software
Discover the most powerful Linux
software and get using it
t.html {redirect_to @ta$k, notice: } format.json {head 78 OpenELEC
y_to_tasks priorityinteger $ bundle exec rake dbimigrate
Get to grips with the media system for
desktops and embedded systems.
e.now #!/usr/bin/en python import pygame from random
[randrangefO, 639), randrangefO, 479), randrangefl, 16)]
82 Virtual Box
sleep); use Curses; Sscreen = new Curses; noecho; curs_ Ensure you get the best out of your virtual
{$star_x[$i] -= $star_s[$i]; if f$star_x[$i] < 0) {$star_x[$i] systems with our essential guide.
” $ gem install bundler $ gem install rails -version=3.2.12
read ;no_content} else formathtml {render action: “edit” 86 NextCloud
migrate $ bundle exec rake db:migrate $ bundle exec rails The break away, all new cloud storage and
random import randrange MAXjSTARS = 100 pygame. document system is live for all.
efl, 16)] stars.append(star) while True: clock.tick(30) for
cursjset(O); for ($i = 0; $i < $numstars; $i++) {$star_x[$i] 90 NagiOS
x[$i] = 80;} $screen->addch($star_y[$i], $star_x[$i], “.”);} Industry-level system monitoring so you
can track all your Linux PCs.
on=3.2.12 $ rbenv rehash $ rails new todolist -skip-test-
r action: “edit”} format.json {render json: @taskerrors,
bundle exec rails server validate :due_at_is_in_the_past
PARS = 100 pygame.init() screen = pygame.display.set_
re: clock.tick(30) for event in pygame.event.get(): if event,
tars ; $i++) {$star_x[$i] = rand(80); $star_y[$i] = rand(24);
r_yf$i], $star_x[$i], } $screen->refresh; usleep 50000;
i new todolist -skip-test-unit respond_to do Iformatl if @i
ider json: @task.errors, status: :unprocessable_entity} $
:due_at_is_in_the_past def due_at_is_in_the_past errors.
game.display.set_mode((640, 480)) clock = pygame.time.
event.getf): if event.type = pygame.QUIT: exit(O) #!/usr/
tar_y[$i] = rand(24); $star_s[$i] = rand(4) +1;} while (1) {
sh; usleep 50000; gem “therubyracer”, “~> 0.11.4” groupi
_to do Iformatl if @task.update_attributes(params[:task])
)cessable_entity} $ bundle exec rails generate migration
in_the_past errors.add(:due_at, ‘is in the past!’) if due_at
lock = pygame.time.Clock() stars = for i in range(MAX_
■ame.QUIT: exit(O) #!/usr/bin/perl $numstars = 100; use
= rand(4) + 1;} while (1) { $screen->clear; for (Si = 0; $i <
rbyracer”, “~> 0.11.4” group development, lest do gem
attributes(params[:task]) format.html {redirect_to ©task,
generate migration add_priority_to_tasks priorityinteger
le past!’) if due_at < Time.zone.now #!/usr/bin/en python
for i in range(MAX_STARS): star = [randrangefO, 639),
imstars = 100; use Time::HiRes gw(usleep); use Curses;
>clear; for ($i — 0; $i < $numstars ; $i++) { $star_xf$i] -=
relopment, lest do gem “rspec-rails”, “~> 2.13.0” $ gem
t.html {redirect_to @task, notice: ‘...’} format.json {head
y_to_tasks priorityinteger $ bundle exec rake db:migrate
e.now #!/usr/bin/en python import pygame from random
; [randrangefO, 639), randrangefO, 479), randrangefl, 16)]
sleep); use Curses; $screen = new Curses; noecho; curs_ The Hacker's Manual | 77
{ $star_x[$i] -= $star_s[$i]; if f$star_x[$i] < 0) { $star_x[$i]
” $ gem install bundler $ gem install rails -version=3.2.12
Software
OpenELEC:
Media streamer
Crack out the hammer, we demonstrate how to build your own smart
streaming stick using a Raspberry Pi for both personal and internet media.
SSH access
Switch on SSH and you have access to controlled by the connman daemon, eg -
the underlying Linux installation via the to change these, navigate to storage/,
Terminal (use ssh root@192.168.x.y cache/conman where you'll find a
substituting 192.168.x.y with your lengthy folder name beginning wifi_.
OpenELEC device's IP address. The Enter this folder using cd wifi* and then
password is 'openelec'). The main type nano settings to gain access.
purpose for doing this is to configure If you’d like to set a static IP address
OpenELEC without having to dive into from here, change the following lines:
System > OpenELEC. Start by typing Is IPv4.method=manual
-all and hitting Enter - you'll see the core Then add the following three lines
folders are hidden by default. beneath IPv6.privacy=disabled:
Basic commands are supported - IPv4.netmask_prefixlen=24
such as ifconfig for checking your IPv4.1ocal_address=192.168.x.y
network settings, and top to see current IPv4.gateway=192.168.X.2
CPU and memory usage. There’s not an Replace 192.168.x.y with your chosen
awful lot you can do here - the idea is to IP address and 192.168.x.z with your
give you access to useful tools only. router's IP address (get this using the > If you’d rather configure OpenELEC via a Terminal,
Network settings in OpenELEC are ifconfig). Save your changes and reboot. you’ll find a limited number of commands available.
You can download the latest version from http:// the Remote tab and you'll find a handy point-and-click
openelec.tv/get-openelec where you'll find v6.0.1 as the on-screen remote to use - what isn't so obvious is that your
latest release for both the Raspberry Pi and also generic PC keyboard now controls Kodi too, as if it were plugged into your
hardware. It's not large, the full disc image is around 100MB. Pi directly. You'll also see tabs for movies, TV Shows and
Bydefault,youonly
The files are compressed in TAR or GZ format, so you’ll first music - once you've populated your media libraries you’ll be need a username
need to extract them. The simplest way to do this is using able to browse and set up content to play from here. (’kodi) to connect
your Linux distro’s GUI - in Ubuntu, eg, copy the file to your This approach relies on your PC or laptop being in line of your remote PC or
hard drive, then right-click it and choose 'Extract Here'. sight of your TV - if that's not practical, press your tablet or mobile to control
Kodi - it's probably
phone into service as a remote control instead. Search the
a good idea to
Build, install and configure Google Play store for Kore (Android) or the App Store for Kodi add a password
Now connect your micro SD card to your PC using a suitable Remote (iOS) and you'll find both apps will easily find your Pi too - navigate to
card reader (you can pick one up for under £3 online) and use and let you control it via a remote-like interface. System > Settings
> Services >
the $dmesgltail command or Disks utility to identify its By default. OpenELEC uses DHCP to connect to your local
Web Server to
mountpoint. Once done, type the following commands - network - if your Pi's local IP address changes, it can be hard add a password
which assume your drive is sdc and that your image file is in to track it down in your web browser for remote configuration. and change the
the Downloads folder. Change this by choosing System > OpenELEC > Connections, username.
$ umount /dev/sdcl selecting your connection and hitting Enter. Choose 'Edit'
$ cd Downloads from the list and pick IPv4 to assign a static IP address you’ll
$ sudo dd if=OpenELEC-RPi.arm-6.0.1.img of=/dev/sdc bs=4M be able to use to always access Kodi in future. You can simply
You'll want to use sudo dd if=OpenELEC-RPi2. stick with the currently assigned address, or pick another.
arm-6.0.1.img of=/dev/sdc bs=4M if installing OpenELEC on Make sure you select 'Save' to enable the change. If all of this
the Pi 2/3. Wait while the image is written to your micro SD sounds like too much bother, check out the box on SSH (see
card - this may take a while, and there's no progress bar, so SSH Access above) for a way to change the underlying
be patient (time for a cup of tea, perhaps?). configuration files instead. »
Once complete, unmount your drive and then eject it.
Insert the micro SD card into the Pi, connect it up to monitor
g Videos Files
Set content
and keyboard and switch it on. You should immediately see a
This directory contains Choose a scraper
green light flash, and the screen come on. (Movies) v A S- The Movie Database
The OpenELEC splash screen will appear, at which point
° Local Information only
it'll tell you it's resizing the card - it's basically creating a data
partition on which you can store media locally if you wish.
After a second reboot, you'll eventually find yourself
presented with an initial setup wizard for Kodi itself. The Movie Database
Content scanning options
If you've not got a mouse plugged in, use Tab or the cursor
Movies are in separate folders that match the movie title
keys to navigate between options, and Enter to select them.
Scan recursively
Start by reviewing the hostname - OpenELEC - and
Selected folder contains a single video
changing it if you're going to run a media server and the name
Exclude path from library updates
isn’t obvious enough already. Next, connect to your Wi-Fi
network by selecting it from the list and entering your
passphrase. You can then add support for remote SSH access Settings OK Cancel
» Set up libraries
The first thing to do is add your media to your library. Kodi
supports a wide range of containers and formats, so you
should have no problem unless you’ve gone for a particularly
obscure format. Check the box (see Add Content to your
Library, below) for advice on naming and organising your
media so that allows Kodi to recognise it and display extra
information about TV shows and movies. This uses the help
of special ‘scrapers’; tools that extract metadata from online
Want to update
databases such as movie titles, TV episode synopses and
OpenELEC to the
latest build? First, artwork to pair them with your media files for identification.
> The Amber skin is a beautiful alternative to the more
downloadthelatest Where should you store this local content for Kodi to get
functional Confluence default. Sadly, there's no access to
update file (in at it? If your micro SD card is large enough - we’d suggest
the OpenELEC configuration menu from it.
TAR format) from
64GB or greater - then you can store a fair amount of video
http://openelec.
tv/get-openelec
and music on there. You can transfer files across the local UK for movies, eg). Click ’OK’ twice and choose ‘Yes' when
and open File network - open File Manager and opt to browse your prompted to update the library.
Manager and click network. Your OpenELEC device should show up - double Once done, you'll find a new entry - Library - has been
Browse Network. click the file sharing entry and you’ll see folders for Music. added to the media menu on the main screen. This gives you
Double-click
Pictures, TV Shows and Videos - simply copy your files here access to your content with filters such as genres, title or year
your OpenELEC
device and copy to add them to your library. Once done, browse to Video or to help navigate larger collections. Now repeat for the other
the TAR file into Music and the media files should already be present and types of media you have. If you want to include multiple folder
the Update folder. accounted for, although at this point in time they've not been locations within single libraries, you’ll need to browse to the
Reboot OpenELEC
assigned a scraper to help you identify them yet. Files view, then right-click the library name (or select it and
and you'll find
the update will
It can be slow copying files across in the network - you press c on the keyboard) to bring up a context menu. Select
be appliec. can transfer files directly to the card when it’s mounted in a 'Edit Source’ to add more locations, and ’Change Content’ to
card reader on your PC. but you'll need to access File change the media type and scraper if necessary.
Manager as root to do so - in Ubuntu, eg, typing $ gksudo The smartest thing to do with any digital media library is
nautilus and hitting Enter will give you the access you need. host it on a media server, which allows you to easily access it
A simpler option - if you have a spare USB port on your Pi - from other devices on your network and - in some cases -
is to store your media on an external thumb or hard drive. over the wider internet. Kodi has UPnP media server
Just plug the drive into your Pi. browse to Videos or Music capabilities that work brilliantly with other instances of Kodi
and choose the ’Add...’ option. Click 'Browse' and select the on your network as well as making your media accessible
top-level folder containing the type of media you're adding - from other compatible clients. Media servers can be quite
TV, movies or music. demanding, so we don’t recommend using a Pi Zero or Pi
If you’ve plugged in a USB device, you'll find it under root/ Model B+. Instead, set it up on your most powerful PC (or Pi
media, while NAS drives are typically found under ’Windows 2/3) and use OpenELEC to connect to it as a client.
Network (SMB)'. Once selected, click OK’. The Set Content As media servers go. Kodi's is rather basic. If you want an
dialogue box will pop up - use the up and down arrow attractive, flexible server then see our Emby guide [Features.
buttons to select the type of media you're cataloguing and p32, LXF204]. Pair this with the Emby for Kodi add-on and
verify the selected scraper is the one you want to use. Check you can access your Emby-hosted media without having to
the content scanning options - the defaults should be fine for add it to your Kodi library. A similar add-on exists for users of
most people - and click ‘Settings’ to review advanced Plex Media Server too. PleXBMC (http://bit.ly/PleXBMC),
options (you may want to switch certification country to the providing you with an attractive front-end.
Kodi supports the same naming enormous catalogue and assigns relevant formed in your
convention as its rival services Emby metadata automatically. media library.
Music videos Music VideosXArt ist artist - track name Music Videos\A-ha\a-ha - velvet.mkv
If you want access to other UPnP servers via Kodi without One bottleneck for Pi devices is dealing with large libraries
any bells and whistles, then browse to System > Settings > - give it a helping hand by first going to Settings > Music >
Services > UpnP/DLNA and select 'Allow remote control via File lists and disabling tag reading. Also go into Settings >
UPnP'. You can also set up Kodi as a media server from here: Video > Library and disable ‘Download actor thumbnails'. You
select 'Share my libraries' and it should be visible to any UPnP can also disable 'Extract thumbnails and video information'
client on your network, although you may have to reboot. under File Lists.
Performance is going to be an issue on lower-powered The default Confluence skin is pretty nippy, although if you
devices, such as the Pi, and while the Pi 2 and 3 are pretty suffer from stutter when browsing the home screen, consider
responsive out of the box. the Pi Zero may struggle at times. disabling the showing of recently added videos and albums:
It pays, therefore, to try and optimise your settings to give select Settings > Appearance, then click Settings in the right
your Pi as much resources as it needs to run smoothly. Start hand pane under Skin. Switch to 'Home Window Options' and
by disabling unneeded services - look under both System > de-select both ‘Show recently added...'options.
OpenELEC > Services (Samba isn't needed if you're not Speaking of Confluence, if you don't like the default skin,
sharing files to and from Kodi, eg) and System > Settings > then try Amber - it's beautiful to look at, but easy on system
Services (AirPlay isn't usually required). Incidentally, while resources. You do lose access to the OpenELEC settings when
you're in System > Settings, click 'Settings level: Standard' to it's running, but you can always switch back to Confluence
select first Advanced > Expert to reveal more settings. temporarily or use SSH for tweaks, if necessary. ■
u
W Addons OK
M Modules
Caned
* Rcpostories
M Skins
All.ln.One.zip
iStreamjnstaBer zip
1Stream_Repos1tofy.zip
XunityTalk.Repository zip
VirtualBox:
Virtualisation
We reveal how virtualisation software can tap into your PC’s unused
processing power to help you run multiple operating systems.
oday's multi-core PCs are built to run multiple tasks your toes in the water) than with the open-source solution.
Headless setup
One way to maximise your host PC's resources is VBoxManage startvm "VM name" --type
to run your virtual machine headless. This means headless
there’s no way of interacting with that VM on the Alternatively, hold Shift as you click the VM
host PC: instead, you access it remotely using in the VirtualBox Manager, and you'll be able to
the Remote Display Protocol (RDP). First, make monitor its progress from the Preview window
sure you have the VirtualBox Extension Pack before switching to your remote computer.
installed - this provides support for VirtualBox's When it comes to accessing your headless VM
implementation of RDP - then enable it on your from another PC, the rdesktopclient is built into
VM via Settings > Display > Remote Display tab most distros, but VirtualBox a\so ships with
by ticking 'Enable Server'. You’ll need to change rdesktop-vrdp. which gives your guest access to
the default port (3389) if you're setting up any USB devices plugged into the PC you're sat
multiple VMs in this way - choose unique ports at. Use the following command:
for each between 5000 and 5050. rdesktop-vrdp -r usb -a 16 -N 192.168.x.y;0000
Once it's configured, you can launch your VM Replace .x.y with your host PC's IP address,
from the Terminal via one of two commands: and OOOO with the port number you allocated > Run your VM headless to cut resource
VBaxHeadless -startvm <uuidlvmname> (3389 by default). usage if you plan to access it remotely.
The figure you set is actual host RAM, not virtual memory, so Other key settings
be sure to leave enough for your PC's other tasks (including Switch to the Display tab to configure your virtual graphics
the running of VirtualBox itself). card. Start by allocating as much memory as you think
The final option is to create a virtual hard disk. This you'll need, and also tick the 'Enable 3D Acceleration' box to Make use of
basically starts out as a single file that represents your guest’s improve performance across all your VMs. If you're running a the VirtualBox
Manager's new
hard drive, and will splinter off only when you start working Windows virtual machine, then tick the 2D option too. Switch
Group feature to
with snapshots {picturedbelow). In most cases, leave 'Create to the Remote Display tab if you'd like to access your VM organise your VMs
a virtual hard disk now' selected and click 'Create', at which remotely. The Video Capture tab makes it possible to record into user-defined
point you'll need to set its size, location (click the little folder your VM screen as a video should you want to do so - the categories: right
former feature requires the VirtualBox Extension Pack, which click the first VM
button to choose a different location from the default), file
in the list and
type and how the virtual file will behave. For these latter we'll talk about shortly.
choose'Group:
options, the defaults of 'VDI' and 'Dynamically allocated’ The Storage tab is where you can configure the internal Right-click the
usually work best; the latter ensures that the physical f le storage of your virtual PC - by default your virtual hard drive group header and
containing your virtual hard drive's contents starts small and is added to the SATA controller, from where you can add more choose'Rename',
then create new
grows only as it's filled with data. Click 'Create' and you- drives. You'll also see that a single DVD drive is also added to
machines directly
virtual machine is ready and waiting for action. the IDE controller. Select it and click the little disc button next from this group or
to the Optical Drive drop-down to select a physical drive or drag other guests
Virtual hardware tweaking mount an ISO disk image as a virtual drive instead. Tick the into it to assign
them to the group.
It’s tempting to dive straight in and start using your new 'Passthrough' option if you'd like to be able to write discs, play
virtual machine, but while the basic hardware settings are in audio CDs or watch encrypted DVDs.
place, you should take the time to ensure it has all the power The options in the Audio and Serial Ports tabs are largely
and resources it needs to function as you want it to. You can self-explanatory, but if you plan to make your guest VM visible
always tweak these settings later, but the best time to set it over your local network for the purposes of sharing files and
up is before you begin. other resources, then select 'Network' and change the NAT
Select your new virtual machine and click the 'Settings' setting to 'Bridged Adapter'. Other configurations are also
button. Switch to the System tab, where you'll find three tabs: available from here - 'NAT Network', eg, allows you to create a
Motherboard, Processor and Acceleration. You can tweak network of VMs that can see and interact with each other
your VM's base memory from the Motherboard tab, as well while remaining invisible to the host. NAT networks are
as switch chipset. although unless you need PCI Express
support the default PI 1X3 should be fine in most cases.
The Pointing Device is set to 'USB Tablet' by default, but
there s a 'PS/2 Mouse' option for legacy purposes.
The Extended Features section should already be set up
according to the OS you've chosen, but if you’d like your
virtual machine to have a UEFI rather than a BIOS, tick
'Enable EFI’ here. Note, however, that this works only for
Linux and OS X; Windows guests aren't (yet) supported.
If you have a multi-core CPU installed, switch to the
Processor tab to allocate more than a single core to your VM,
making sure you don't attempt to allocate more cores than
your processor physically possesses (Hyperthreading should
be discounted). You may also need to tick 'Enable PAE/'NX’ if
your virtual machine needs access to more than 4GB of RAM
on a host PC with an older 32-bit processor.
The Acceleration tab allows you to tap into the processor's > The ability to take snapshots of your virtual machines makes them
virtualisation features if they exist - see the tip for details. particularly suitable as test beds.
» configured independently via VirtualBox's File > Preferences physical disc) containing the installer of the OS you wish to
menu (look under Network). emulate, then start the VM and follow the prompts to get
started. Once running, your virtual machine acts in exactly
Working with USB peripherals the same way your main PC does - click inside the main
The USB tab is where you can capture specific USB devices window and your mouse and keyboard may be 'captured' by
for use in your VM. However, before you can use this feature, the VM. allowing you to work inside it. To release these back
you need to make sure you add your username to the to your host PC. press the right-hand Ctrl key.
vboxusers group on your host PC using the following Once you've installed your target OS in the guest machine
command in the Terminal: you'll need to install the Guest Additions - a series of drivers
sudo usermod -a -G vboxusers <username> and applications that enhance the VM's performance. Key
Once this is done, your USB devices will become visible additions include a better video driver supporting a wider
to your VirtualBox guests. Note that VirtualBox supports range of resolutions and hardware acceleration, mouse
only the older USB 1.1 implementation by default, but you pointer integration, which allows you to more easily move the
can install the VirtualBox Extension Pack to add support for mouse between host and VM without it being captured, and
USB 2.0 and USB 3.0 among other extras (including PCI and support for shared folders.
host webcam passthrough). Download this Extension Pack Installing these for Windows guests is as simple as
from www.virtualbox.org. but note the licence restrictions: selecting Devices > Insert Guest Additions CD image... After a
unlike VirtualBox. it’s not open source and is free for ’personal short pause, the setup wizard should appear. Things are a bit
It's possible to evaluation’ only. more complicated for Linux guests - see chapter 4.2.2 under
port your virtual
You can easily connect to USB devices within your guest VirtualBox's Help > Contents menu for distro-by-distro
machines to
different PCs - on the fly - click the USB button on the guest machine guides. Once you've followed the prerequisites, open the file
select File > Export window and select your target peripheral from the list - but manager and browse to the root of the Guest Additions CD.
Appliancetosetup adding specific USB Device Filters here makes it possible to then right-click inside the window and choose 'Open in
an archive in OVF
automatically capture specific devices when the VM boots. Terminal’. Once the Terminal window opens, the following
(OpenVirtualization
Format) format,
One example of where this could be handy is if you set up a command should see the additions installed:
using the OVA VM as a headless TV server - it would allow the VM to take sudo sh ,/VBoxLinuxAdditions.run
extension to control of your USB TV stick the moment it starts. We cover After rebooting you should be able to resize your VM
bundle everything the Shared Folders tab in the 'Share data' box below, while window to the desired resolution simply by clicking and
into a single file. Be
the User Interface tab allows you to specify which menu dragging on it - have the Displays panel open in your guest
warned: it doesn't
include snapshots options are made available to this guest. when you're doing this to verify the dimensions as you resize.
and often changes
thevirtualharddisk Your first boot Take a snapshot
from VDI to
With your VM's hardware set up. you're ready to go. You need Your VM is now set up and ready for action. It should work in
VMDK format.
to point your virtual CD/DVD drive towards an ISO file (or exactly the same way as any physical machine, but it has one
Share data
Getting data to and from your VM is a critical part of achine View Input Devices Help
virtualisation, and VirtualBox makes this as simple as © Optical Drives
possible. The obvious way is to set up a bridged network as lows 10 (Pre-lnfectlc
& Network
described earlier, then create shared folders with which you
f USB
can swap data over your network, but there are other handy
9 Webcams
sharing tools provided too.
I® Shared Folders
The Shared Folders feature works best with guests you
don't want exposed to the wider network, and also allows li Shared Clipboard
you to make folders available from your host without sharing ■5- Drag and Drop
them on the network. Open your VM's settings and go to the / Insert Guest Additions CD image...
Shared Folders tab and you can specify a folder on your host
PC that's made available to your guest: click the plus ('+')
button, select the folder you want to share and change its
display name on your guest if necessary. You can also elect
to make the folder read-only to the guest, have it mount
automatically when the VM starts and. last but not least,
choose Make Permanent’to have the shared folder persist
beyond the current VM session.
Open the Devices menu and you'll find two other ways
of sharing too: Shared Clipboard allows you to share the
contents of the clipboard between host and guest (this can
be limited to one-way sharing, or made bi-directional).
You can also implement Drag-and-Drop. another way to
quickly share files between host and guest by dragging files > Make life (and file-sharing) easy: you can configure VirtualBox to allow you
into and out of the guest machine window. to quickly transfer files to and from your guest using drag-and-drop.
Nextcloud:
Share your files
Remote storage silos are a dime a dozen, but be wary of their privacy
policies. We explain how to set up your own and keep control.
nline storage services such as Dropbox offer a command-line wizard to help you setup a password for the
Cloud control
In the main tutorial we've looked at Server settings. Server info. Usage report public shares, set a default expiry date for
setting up and using a default Netcloud and more. The Server info option is all public shares, restrict members of
instance. But as the admin you can tinker different from the others in that instead share files only with others users in their
with several settings to acclimatise of helping you tweak any settings it only group, and more. You can configure the
Nextcloud as per your requirements. visualises various details about the Nextcloud server to send out emails for
"o access these settings, roll-down the Nextcloud server such as the load on the various types of notifications and
menu next to your username and select CPU, memory usage, and more. password resets from the Additional
the Admin option. This takes you to a Head to the Sharing section to settings section. This page also lets you
page that lists several settings that affect configure the policy for sharing files on define a password policy by forcing the
the entire Nextcloud installation grouped the server. Here you can toggle options to minimal length, the use of mixed cases,
under various different heads such as force users to set a password on all numeric and special characters.
log-bin-index = /var/log/mysql/mariadb-bin.index
binlog_format = mixed SetEnv HOME /var/www/nextcloud
Save and close the file when you're done. Then reload SetEnv HTTPJHOME /var/www/nextcloud
MariaDB service with sudo systemctl reload mysql.
Similarly, you'll also have to make some tweaks to the </Directory>
Apache web server. Nextcloud needs several modules to
function correctly. Enable them with the a2enmod rewrite Save the file and bring Nextcloud online with:
and a2enmod headers commands. $ sudo In -s /etc/apache2/sites-available/nextcloud.conf /etc/
Also while you can use Nextcloud over plain HTTP, the apache2/sites-enabled/nextcloud.conf
Nextcloud developers strongly encourage the use of SSL/ That's the command-line stuff taken care of. Now fire up a
TLS to encrypt all server traffic, and to protect user's logins web browser on any computer on the network and head to
and data in transit. Apache installed under Ubuntu already https://192.168.3.106/nextcloud Replace 192.168.3.106
comes equipped with a simple self-signed certificate. All you with the IP address or domain name of the server you’ve
have to do is to enable the SSL module and the default site deployed Nextcloud on.
and accept the use of the self-signed certificate: Since this is the first time you're interacting with
$ a2enmod ssl Nextcloud, you'll be asked to create an admin account.
$ a2ensite default-ssl Enter the username and password for the Nextcloud
When you are done, restart the Apache server to load the administrator in the space provided. Then scroll down and
modules with sudo systemctl restart apache2 . expand the Storage & database pull-down menu to reveal
more options. The data folder is where Nextcloud will house
In the clouds the files shared by the users. Although it'll already be
Now that we’ve laid the groundwork for Nextcloud, let's fetch populated with a location, for security reasons the
and install the server. Head to www.nextcloud.com/install Nextcloud developers advise that it's better to place the
and grab the latest version which is vlO.O.l at present: data directory outside the Nextcloud root directory, such as
$ wget -c https://download.nextcloud.com/server/releases/ /var/www/data.
nextcloud-10.0.1 ,tar.bz2 You're next prompted for several details about the
$ tar xvf nextcloud-10.0.1.tar.bz2 database server. By default Nextcloud uses the SQLite
You can backup
Deflating the archive will create a new directory named database which is adequate for smaller installations.
your entire
nextcloud in the current working directory. Copy the new However, we've already setup the industry-standard MariaDB Nextcloud install to
directory and all of its content to the document root of the which can handle all sorts of loads. Use the textboxes to enter a remote location
Apache server with sudo cp -r nextcloud /var/www/. Then the username and password for the user we created earlier to with something as
hand over the control of the directory to the Apache user manage the nextcloud database. Then press the Finish setup simple as rsync
(www-data) with sudo chown www-data:www-data /var/ button to let Nextcloud connect to the database and create -Aax/var/www/
nextcloud/
www/nextcloud/ -R. the appropriate structure for the Nextcloud installation.
nextcloud-dir-
We’ll install and access Nextcloud from under its own That's it, your Nextcloud server is up and running. You'll
backup_date
directory by creating a configuration file with sudo nano /etc/ now be taken to Nextcloud's dashboard. While you can start
+"%d%m%Y"7.
apache2/sites-available/nextcloud.conf and the following: using the server to upload and download files straight away,
let's take a moment to get the house in order.
Alias /nextcloud /var/www/nextcloud/ For starters, roll-down the menu next to your username in
the top-right corner and click the Personal link. Here you can
<Directory /var/www/nextcloud/> review and change several settings for your account, such as
Options +FollowSymlinks the password and display name. It also lists the groups you
AllowOverride All are part of. If your Nextcloud deployment is going to be used
by multiple people, it's advisable to organise users into
<IfModule mod_dav.c> different groups. To do this, select the Users option from the
Dav off pull-down menu. You can then use the forms on the page to
</IfModule> create groups and users. While adding users, you can also »
Be omnipresent
The real advantage of commercial cloud from the internet. The smarter way is to use a To use PageKite, fire up a terminal and install
services, such as Dropbox, is that you can tunnelling service such as PageKite. It uses a the PageKite software with:
access data stored within them from any Python script to reverse tunnel from your $ curl - s https://pagekite.net/pk/1 sudo bash
computer connected to the internet. However, computer to a subdomain.pagekite.me Now assuming your storage server is running
by default, your Nextcloud storage server will address. The service uses a pay-what-you-want on port 80. put it on the internet with
only be accessible from computers within the model. The minimum payment of $4 (about $ pagekite.py 80 mynextcloudserver.pagekite.me
network it's set up on. But that's not to say that £3.00) gets you 2GB of transfer quota for a That's it. Your private server is now publicly
you can't access it from the internet. Either get a month. Pay more to get more bandwidth for a accessible on https://mynextcloudserver.
static IP or use a dynamic DNS service and then longer duration and the ability to create pagekite.me. Remember to replace
poke holes in your router's firewall to allow traffic additional .pagekite addresses. mynextcloudserver with your own name.
External Storage
"smbcllenr is not installed. Mounting of 'SMB / CIFS’, *SMB / CIFS using OC login’ is not possible. Please
ask your system administrator to install It.
mayank.n10.biz?gm<
Grant access
Amazon S3______________
□ Allow users to mount externA^^^^^H
। P
Google Drive
Global credentials Local
Nextcloud
geekybodhi .......... openstack Object storage
SFTP
webDAV
Nagios: Monitor
your PC realm
Keep an eye on your network from the comforts of your armchair and the
power of an industrial-level monitoring solution.
cfg_dir=/usr/local/nagios/etc/servers
Save and exit the file and the create the specified directory prompts you to setup its password. That's all there is to it.
with sudo mkdir /usr/local/nagios/etc/servers . You should Now restart Apache and the Nagios service:
also take a moment to specify an email address for Nagios to $ sudo service apache2 restart
send notifications to whenever it picks up an issue with one of $ sudo systemctl start nagios
the computers it's monitoring. While this is purely optional it's Then fire up a web browser on any computer on the
a natural extension of having a monitoring server. But for this network and access the administration interface by
to work you'll need a functional email server as well, which is appending /nagios to the domain name or IP address of the
a project in itself. However later in the tutorial we'll use a nifty computer you've setup Nagios on. Assuming the address of
little script that'll let Nagios send notifications via Gmail, the Nagios server is 192.168.3.104, you can access the
which should work nicely for smaller networks. For now, open Nagios administration interface at 192.168.3.104/nagios.
the contacts.cfg file with sudo nano /usr/local/nagios/etc/ You'll be prompted for the login credentials of the Nagios
objects/contacts.cfg and replace the default email with your admin that you've just created.
email address. After authentication you’ll be taken to the Nagios
administration console which is loaded with information. It
Dash to the dashboard and might look daunting at first but it presents all information
The final aspect of the setup process is configuring the in a logical manner and is very intuitive to operate. For
environment for the web-based administration dashboard. starters, head to the Hosts link in the navigation bar on the
Begin by enabling the rewrite and CGI Apache modules with left. Even though you haven't configured any hosts for
sudo a2enmod rewrite && sudo a2enmod cgi. monitoring yet. by default the page will list one machine: the
Now setup Nagios as a virtual host inside Apache by localhost on which Nagiosis installed and running.
copying over the sample configuration file with sudo cp
sample-config/httpd.conf Zetc/apache2/sites-available/ Open for business
nagios4.conf. Give it the right access permissions with sudo The client computers you wish to monitor are known as
chmod 644 Zetc/apache2/sites-available/nagios4.conf before hosts in Nagios parlance. To add a host shift over to that
enabling the new virtual host using sudo a2ensite nagios4. computer (either physically or via SSH) and install Nagios
conf .You should also create the authentication details to Plugins and NRPE with sudo apt install nagios-plugins
login to the administration interface. The command sudo nagios-nrpe-server . NRPE is the Nagios Remote Plugin
htpasswd -c /usr/local/nagios/etc/htpasswd.users Executor which allows you to remotely execute the Nagios
nagiosadmin creates a user named nagiosadmin and plugins on other Linux machines so that you can monitor »
Reusable configuration
One of the best features in Nagios is known as manageable, network admins can reuse notifications. The generic-service template
object inheritance. Nagios makes it pretty configuration for pretty much the same works similarly but for individual services rather
straightforward to monitor a large number of advantages. than hosts. The default values defined in the
hosts and services thanks to its ability to use The use keyword in the host and service template file however can be overridden in the
templates that come in handy while setting definition files points to the templates from individual host definition file.
them up. Thanks to templates you can define which the files will inherit objects. The linux- The check_command keyword is also similar
the default values for the host and services server and generic-service templates used in the in function to the use keyword. It points to the
inside a single file rather than having to retype example definitions in the tutorial are defined in commands that are defined in the /usr/local/
them constantly. the/usr/local/nagios/etc/objects/ nagios/etc/objects/commands.cfg file. This
Just like programmers reuse code to templates.cfg file. The linux-server template file contains all the commands for checking
streamline their code and make it more sets defaults for aspects like event handling and various services, such as DHCP. SSH and more.
sendEmail script to ask Nagios to email you notifications actual email address, login id and password for the sender
using a freely available service like Gmail. along with the recipient's email address. If all goes well, the
As usual, first fetch the components the script relies on script will send an email from the sender's email account to
with sudo apt install libio-socket-ssl-perl libnet-ssleay-perl the recipient's email address.
perl. Once these are installed, fetch the script and extract it: Once you've tested the script, you'll need to configure
$ wget http://caspian.dotconf.net/menu/Software/SendEmail/ Nagios to use it to send notification emails via an external
sendEmail-vl .56.tar.gz SMTP server. First up. add the details about Gmail’s SMTP
$ tar xvf sendEmail-vl.56.tar.gz server in the resource.cfg file:
Now change into the extracted folder and copy over the $ sudo nano /usr/local/nagios/etc/resource.cfg
sendEmail script to the folder that houses all the executables
and make it one as well: $USER5$=youremail@gmail.com
$sudocp sendEmail*vl.56/sendEmail /usr/local/bin $USER7$=smtp.gmail.com:587
$ sudo chmod +x /usr/local/bin/sendEmail $USER9$=senders-login-id
It's also a good idea to create a log file for the script to $USER10$=senders-password
write any errors into:
$ touch /var/log/sendEmail Save the file and then edit the command.cfg file and
$ chmod 666 /var/log/sendEmail replace the 'notify-host-by-email' and ‘notify-service-by-email’
If the emails don’t show up in your inbox after you’ve run lines to read:
through this tutorial, check this log file for details with tail -f / # ‘notify-host-by-email’ command definition
var/log/sendEmail. define command{
Note that Gmail has dropped support for SSLv3, so you'll command_name notify-host-by-email
have to tweak the script to get it to work. Open /usr/local/ commandJine /usr/bin/printf “%b” “***“ Notification
bin/sendEmail in a text editor and jump down to line 1906. from Nagios ***** \n\n Notification Type:
Here drop the SSLv3 bit and change the SSLv3 TLSvl line $NOTIFICATIONTYPE$\n Host: $H0STNAME$\n State:
to only read TLSvl. Now save and close the file. $H0STSTATE$\n Address: $HOSTADDRESS$\n Info:
You can now test the script by sending an email from the $H0ST0UTPUT$
CLI in the following format: }
$ sendEmail -v -f [senders-email@gmail.com] -s smtp.gmail.
com:587 -xu [senders-login-id] -xp [Password-for-senders- # ‘notify-service-by-email’ command definition
login] -t [recipient-email-address@gmail.com] -o tls=yes -u define command{
Test email from CLI -m “This really works, eh?l?” command_name notify-service-by-email
Replace the text marked by the [square brackets] with the commandJine /usr/bin/printf “%b” “**“* Notification
from Nagios ***** \n\n Notification Type:
$NOTIFICATIONTYPE$\n Service: $SERVICEDESC$\n
Host: $HOSTALIAS$\n Address: $HOSTADDRESS$\n State:
$SE$
}
Here we've defined the template for the notifications
that'll be sent out for both the host as well as the service.
Double check them before putting them into use by restarting
Nagios with service nagios restart 0.
That's it. If any of the hosts or services within them
misbehave. Nagios will automatically alert you by sending a
notification to the email address specified in the contacts,
cfg file earlier. Your monitoring server is now all set. You can
add more hosts and expand the services it monitors following
the relevant sections of the tutorial. Now put your feet up and
> Use the Map option from the navigation menu on the left sip on that pina colada while Nagios herds your network on
to visualise the hosts on your network. your behalf. ■
I I fl fl B I
aprocessable_entity} emigrate $ bundle exec rake db:migrate $
flB^^BB flipp^flik <^pi^Bflfl|
^^B ^^B ^^B
fl Bbhbi B MH
.html B B B B^lse
tec rails generate migration add_priority_to_tasks priorityinteger $ bundle exec rake db:migrate S bundle exec rake dbrmigrate $ bundle exec rails server validate
at, ‘is in the past!’) if due_at < Time.zone.now #!/usr/bin/en python import pygame from random import randrange MAX_STARS = 100 pygame.init() screen = py
ars = for i in range(MAX_STARS): star = [randrange(0,639), randrange(O,479), randrange(l, 16)] stars.append(star) while True: clocktick(30) for event in pygame.
Inumstars = 100; use Time::HiRes qw(usleep); use Curses; Sscreen = new Curses; noecho; curs_set(0); for (Si = 0; Si < Snumstars ; $i++) {$star_x[$i] = rand(80); $s
clear; for (Si = 0; Si < Snumstars ; $i++) {$star_x($i] — $star_s[$i]; if ($star_xf$i] < 0) {$star_x($i] = 80;} Sscreen->addch($star_y[$i], $star_x[$i], “.”);} $screen->refre
lent, lest do gem “rspec-rails”, “~> 2.13.0” $ gem install bundler $ gem install rails -version=3.2.12 $ rbenv rehash $ rails new todolist -skip-test-unit respond
nl {redirect_to ©task, notice:'...’} formatjson {head :no_content} else format.html {render action: “edit”} formatjson {render json: ©taskerrors, status: :unprc
ity_to_tasks priority integer $ bundle exec rake db:migrate $ bundle exec rake db’.migrate $ bundle exec rails server validate :due_at_is_in_thejpast def due_at_is_
me.now #!/usr/bin/en python import pygame from random import randrange MAX_STARS - 100 pygame.init() screen = pygame.display.set_mode((640, 480)) c
star = [randrange(0, 639), randrangefO, 479), randrangefl, 16)] stars.append(star) while True: clock.tick(30) for event in pygame.event.get(): if event.type == pyg
tes qw(usleep); use Curses; Sscreen = new Curses; noecho; curs_set(0); for (Si = 0; Si < Snumstars ; $i++) { $star_x[$i] = rand(80); $star_y($i] = rand(24); $star_s[$i]
s ; $i++) { $star_x($i] -= $star_s[$i]; if ($star_x[$i] < 0) { $star_x[$i] = 80;} $screen->addch($star_y[$i], $star_x{$i], “.”);} $screen->refresh; usleep 50000; gem “then
Is”, 2.13.0” $ gem install bundler $ gem install rails -version=3.2.12 $ rbenv rehash $ rails new todolist -skip-test-unit respond_to do Iformatl if @taskupdate_
’} formatjson {head :no_content} else format.html {render action: “edit”} formatjson {render json: ©taskerrors, status: :unprocessable_entity} $ bundle exec rails
exec rake db:migrate $ bundle exec rake dfrmigrate $ bundle exec rails server validate :due_at_is_in_the_past def due_at_is_in_the_past errors.add(:due_at, ‘is in th
rgame from random import randrange MAX_STARS = 100 pygame.initQ screen = pygame.display.set_mode((640, 480)) clock = pygame.time.Clock() stars = 1
s(0, 479), randrange(l, 16)] stars.append(star) while True: clock.tick(30) for event in pygame.event.get(): if event.type — pygame.QUIT: exit(O) #!/usr/bin/perl $nt
new Curses; noecho; curs_set(0); for ($i = 0; $i < Snumstars ; $i++) { $star_x($i] - rand(80); $star_y[$i] - rand(24); $star_s[Si] = rand(4) + 1;} while (1) { Sscreen-
.]; if ($star_x[$i] < 0) {$star_x(Si] = 80;} $screen->addch($star_y($i], $star_x[$i], “.”);} Sscreen->refresh; usleep 50000; gem “therubyracer”, “~> 0.11.4” group :deA
ndler $ gem install rails -version=3.2.12 $ rbenv rehash $ rails new todolist -skip-test-unit respond.to do Iformatl if @task.update_attributes(params[:task]) forma'
nt} else format.html {render action: “edit” } formatjson {render json: ©taskerrors, status: :unprocessable_entity} $ bundle exec rails generate migration add_priori1
exec rake db:migrate S bundle exec rails server validate :due_at_is_in_the_past def due_at_is_in_the_past errors.add(:due_at, ‘is in the past!’) if due_at < Time.zon
ndrange MAX_STARS = 100 pygame.init() screen = pygame.display.set_mode((640, 480)) clock = pygame.time.Clock() stars = for i in range(MAXJSTARS): star =
and(star) while True: clocktick(30) for event in pygame.event.get(): if event.type = pygame.QUIT: exit(O) #!/usr/bin/perl Snumstars = 100; use Time::HiRes qw(us
($i = 0; Si < Snumstars ; $i++) { $star_x[$i] = rand(80); $star_y($i] = rand(24); $star_s[$i] = rand(4) + 1;} while (1) { $screen->clear; for (Si = 0; $i < Snumstars ; $i++)
reen->addch($starjy[Si], $star_x($i], “.”);} $screen->refresh; usleep 50000; gem “therubyracer”, “~> 0.11.4” group development, :test do gem “rspec-rails”, "~> 2.13.0
■w w
Hacking
Take your Linux skills to
the next level and beyond
96 Hacker’s Toolkit
Discover the tricks used by hackers
to help keep your systems safe.
igh-profile headlines involving the when Linux was still young, there probably complex, in fact, that beyond the usual
Install Parrot
Hacking 101
Starting with the humble ping command and moving on
to some stealthy network recon activities...
lmost 10 years have passed since the infamous involves sending an ICMP packet to a host (or hosts
II ■ * E =
Next Pause Stop Pref. Prot. Nodes
Protocols
fe80:
fdW56C:397f
:8f03:9561:a68e:7799
fe80::1813:6bab afe§0::f53b:a*2:2275:9683
fe80::803:5>2d;d7a8:8f6
ICMP fe80::fcde 41d5:8556
239.255*^55.250
>uters
239.255t250.250x
230.WL1
224.0t0.252
ICPMPV6 ff02t:l:3
224
dns.google
192.168*1 3X2fo^.
NETBIOS-NS 157.240.221.24
192.168*133.24>-
) In just a 192.16€. 133.1
IP_UNKNOWN 192.168tl33.203
197^8.133.20
few seconds 192.i68tl33.175
EtherApe had ^^^^092.168.133.45
MDNS 192.168tl33.118
sniffed the traffic 1921fo.133.48
192.168tl33.110
from a sizeable -192.168.133.57
192.168.133.87
chunk of Future J92.lfo.133.76
192.168.133. ^33.81
Towers' review UDP-UNKNOWN
network.
Introducing Nmap
Parrot comes with a handy GUI front-end that first 24 bits of the (32-bit) IPv4 address. Now hit
saves you learning (at least until the next page) the Start button and the background terminal
Nmap S lengthy command line syntax. You'll will jump into life while the scan completes.
find it under Pentesting >lnformation When it’s done save the list of discovered IPs
Gathering>Nmapsi4. There's an option to run it using the button at the top. We'll analyse these
as root, but don't worry about that for now. further over the page. If you set up USB
From the welcome screen select Discover a persistence as described earlier, and booted
network, then specify a CIDR address and prefix using one of the Persistence modes from the
length. To scan the 256 address beginning with Advanced menu, then you can save it in the
192.168.0. for example, use the address default user's home folder and it’ll still be there
192.168.0.0 with a prefix size of 24. If you like on reboot. Otherwise don't worry because it’s
binary that's all the addresses which match the easy to regenerate this list later.
x Scan Options . i Save IP list B Load IP list 0 Control _ predecessors, so this shows up as something other than
ph read: I
ft Network discover
Raspberry Pi Foundation
-Proce
sThread:! Discovered Probe
discover
IP/s Probes Modes: --tcp-connect Spotting running services
f.168.13
discover r 192.168.133.1
92.168. r 192.168.133.35
192.168.133.55
CIDR Notation address Range of IP
Let's forget about st'ay Pis and consider the services
discover
[92.168. 192.168.133.87 CIDR Notation (IPv4) running on your own network. Looking at the previous
nscover
92.168.
r 192.168.133.175
192.168.133.118
Selected your CIDR address: scan results may (depending on what the boxes on your
Cl DR Address: 192
Jiscover r 192.168.133.213 network are doing) reveal hosts running SSH, web
192.168.
Jiscover
r 192.168.133.255 Prefix Size:
interfaces, Windows File Sharing (NetBIOS/SMB/CIFS),
Number of IP: 256
92.168.
nscoverj remote desktop (VNC/RDP) as well as some things
Or you can paste Cl DR address below:
92.168.
Cl DR address:
you've probably never heard of. The services running may
nscover
[92.168. be different to those listed - service names are just
ft Start with ClDR-styte address
assumed from the port number at this stage.
Packets trace Now consider your home router. It’ll almost certainly
be running a web control panel on port 80, but there
may be all kinds of other services running. If you want to
ft
■
ike-scan
(S) Password Attacks
Maltego
@ Wireless Testing
netdiscover
Trash (£•) Sniffing & Spoofing k Nmapsi4 - QT GUI for Nmap
Digital Forensics
Network exploration or security auditing with QT GUI
(§) Automotive
iMiiiop - me imciwui k i»idppei
© Reverse Engineering
* DpOf
E wireshark
JJ Menu 1ES
guesswork if it encounters unknown fingerprints. Our machine. Out of curiosity, we thought we’d investigate
router, the previous scan results suggest, might have a the UPnP server running on our router:
web control panel running on port 80, and a UPnP server $ nmap -p 5000 -A -script vulners 192.168.0.1
running on port 5,000. Change those numbers below to We were simply aghast to find th s in the output:
suit your situation. Running I vulners:
$ nmap -A -p80,5000 192.168.0.1 I cpe:/a:miniupnp_project:miniupnpd: 1.9:
told us that the web server was Lighttpd and the other
was MiniUPnpd. That your router has so many services I EDB-ID:43501 7.5 https://vulners.
running (and there may be others hiding behind port com/exploitdb/EDB-ID:43501 ‘EXPLOIT*
knocking protocols) isn't necessarily a worry in itself. I CVE-2017-8798 7.5 https://vulners.
We’ve only scanned the LAN interface, in other words com/cve/CVE-2017-8798
from the inside. If there were so many ports open from Looking at the links told us this was an integer
the outside, that would probably be cause for concern. In signedness error in versions 1.4-2.0 of the MiniUPnP
order to scan it from the outside we need to know its client, and that vulnerable systems could be exploited by
external IP address, which is easy to find using a weosite a Denial of Service attack. While it would be exciting
such as httpsrZ'ipinfo.io.
Exploiting a vulnerable service is usually a critical
step in any illicit computer activity. Last year's Log4shell
Tap into nmap’s potential
vulnerability in a Java logging framework affected
thousands of applications, from Elasticsearch
“Thanks to Nmap’s powerful
containers to Minecraft servers. Unfortunately, many script engine (NSE), all manner of
servers remain unpatched, not just due to administrator
laziness, but because Log4j (the vulnerable framework) custom tasks can be arranged.”
is often buried deep within major applications’
dependencies. Research by Rezilion (see https://bit. playing with the Proof of Concept (PoC) code referenced
Iy/lxf290-rezilion-research) shows not only in those links, it would be for naught. Because this is a
thousands of machines still running vulnerable Log4j 2.x vulnerability in the client program, rather than the server.
versions, but also thousands of machines running older This is an important distinction, because
1.x versions of Log4j. The 1.x series is unmaintained, and portscanning in general can only tell you about
while it might be Log4shell proof, is vulnerable to vulnerable services on the host. There may be plenty of
countless other known attacks. other vulnerabilities in other software running on the
target (and indeed in the human operating it), but Nmap
Deeper probing with Nmap can't help you with this. These scripts only check version
Besides network recon and service discovery, Nmap can information (often only Nmap's best guess at that) so
probe even further still. Thanks to its powerful script seeing output similar to the above shouldn’t be an
engine (NSE), all manner of custom tasks can be immediate cause for panic.
arranged. One of the most useful scripts is provided by Remember that vulnerabilities may only affect
security group Vulners.com. It uses Nmap's ability to certain features of certain programs running in certain
detect the versions of running services, together with configurations. But it's always worth investigating, which
known vulnerability databases to tell you in excruciating is where tools like Pompem (see Pentesting>Exploitation
detail which vulnerabilities might affect the target Tools>Exploit Search) come in handy.
Modern hacking,
ethics and statistics
Read about the largest DDoS in history and how honing
your hacking skills might help you prevent the next one...
gerund and an infinitive walk in to the Linux kernel. playground, or later from first-person shooters such as
Armitage
is a GUI for
Metasploit. To
use it make
sure you start
the Metasploit
Framework from
the System
Service menu.
Ubuntu: Linux
on a tablet
It’s time to dig deep and discover how to successfully install a working
version of Ubuntu on a low-cost Windows 2-in-l tablet.
re you jealous of the sudden proliferation of cheap You're likely to find enthusiasts such as John Wells
Hardware support
What's the current state of play for hardware » Bluetooth This often needs patching with
support for Bay Trail tablets? It varies from later kernels, although our Linx tablet retained
device to device, of course, but there are Bluetooth connectivity throughout, even when
differences. Here’s what you should be looking the internal Wi-Fi adaptor stopped working.
for when testing your tablet: » Sound A problem on many tablets, and even
» ACPI This deals with power management. if the driver is recognised and loaded, required
This is practically non-existent out of the box, firmware may be missing. Be wary here - there
but later kernels do tend to produce support for are reports of users damaging their sound cards
displaying battery status - the Linx appears to while trying to activate them.
be :he exception to the rule here. Suspend and » Touchscreen As we've seen, older kernels
hibernation should be avoided. don't support them, but upgrading to kernel 4.1
» Wi-Fi Later kernels again improve support, or later should yield positive results, albeit with a
but many devices use SDIO wireless adaptors, bit of tweaking.
which aren't supported without patches or » Camera There's been little progress made
custom-built drivers like those found at here so far. In most cases you'll need to wait for > Upgrade the kernel to 4.1 or later to make
https://github.com/hadess/rtl8723bs drivers to appear. Ubuntu touch-friendly on your tablet.
You'll see the Ubuntu loading screen appear and then after We recommend ticking 'Download updates while installing'
a lengthy pause (and blank screen) the desktop should before clicking 'Continue', at which point you’ll probably see
appear. You should also get a momentary notification that the an Input/output error about fsyncing/closing - simply click
internal Wi-Fi adaptor has been detected - one of the key 'Ignore' and then click 'Yes' when prompted to unmount
While it may
indications that this remixed Ubuntu distro has been tailored various partitions. be tempting to
for Bay Trail devices. At the partition screen you'll see what appears to be upgrade the kernel
Up until now you’ll have been interacting with your tablet excellent news - Ubuntu is offering to install itself alongside all the way to the
current release
in portrait mode - it's time to switch it to a more comfortable Windows, but this won't work, largely because it'll attempt to
(4.4.1 at time of
landscape view, and that's done by click the 'Settings' button install itself to your microSD card rather than the internal writing) you may
in the top right-hand corner of the screen and choosing storage. This card can't be detected at boot up, so the install run into issues with
System Settings. Select 'Displays', set the Rotation drop-down will ultimately fail. Instead, we're going to install Ubuntu in your touchpad.
menu to 'Clockwise' and click 'Apply' (the button itself is place of Windows, so select 'Something else’. For now, stick to
kernel 43.3 until
largely off-screen, but you can just make out its left-hand end Ignore any warning about /dev/sda - focus instead on
these problems are
at the top of the screen as you look at it). /dev/mmcblkO, which is the internal f ash storage. You'll see ironed out.
Next, connect to your Wi-Fi network by clicking the four partitions - we need to preserve the first two (Windows
wireless button in the menu bar. selecting your network and Boot Manager and unknown) and delete the two NTFS
entering the passkey. You're now ready to double-click Install partitions (/dev/mmcblk0p3 and /dev/mmcblk0p4
Ubuntu 14.04.3’ and follow the familiar wizard to install respectively). Select each one in turn and click the'-’ button
Ubuntu on to your tablet. You'll note that the installer claims to delete them.
the tablet isn't plugged into a power source even though you Next, select the free space that's been created (31,145MB
should have done so for the purposes of installing it - this is a or thereabouts) and click the'+' button. First, create the main
symptom of Linux's poor ACPI support for these tablets. partition - reduce the allocation by 2,048MB to leave space
3.16.8-M-4dMfte
Unuxlum-J2btt-p«tch.*h Ing-J.16.6-68 generic
whkhiv shell script (1.9 K6) l.lftfi-dS-genertr .
from: https //doc-iO*4-do<s googlevsercontent com Ing-1.16.6-45-generic
.rnwa-e configuration
what should Firefox do with this fief
Open with gedit (default)
installation Ms f rushed. You can continue letting Ubuntu now, but until you
restart the computer, any changes you make or documents you save will not be
preserved
MULTI-BOOTINGWITH
* GRUB t
Having plenty of choice allows you to be fickle,
so it’s time we show you how to have several
distros on your computer at once.
here are lots of Linux distributions Windows installed on the same computer and also look at how you can share things like your
I
Fedora - it would be great to have different from the old
both. So what are you to do? The easier thanks to the almost program, giving rise to a
term ‘dual booting' is usually used reputation for complexity. In
to refer to having a Linux distro and universal adoption of Grub 2.” fact, its modular approach
GNU GRUB
I each distro to maintain its
own boot menu.”
version 2.02~beta2-%buntul.3
entries. You can't
simply add them to the
grub.cfgfile as that
will be overwritten the
next time grub-mkconfig is run, but there is a
file in /etc/grub.d called 40_custom that you
can use to add your own menu entries. Copy
this to a meaningful name, and possible
Advanced options for Linux Mint 17.3 Cinnamon 64-bit
change the number to include it earlier in the
Chainload openSUSE 42.1 menu. Edit this file and add valid menu entries
Chainload Manjaro 15.12
Chainload Fedora 23 to the bottom of this file. Don't touch the
existing content - although you can and
Memory test (memtest86+)
Memory test (memtest86+, serial console 115200) should read it. If you want to load the menu for
Windows 7 (loader) (on /dev/sdal)
openSUSE 42.1 (x86_64) (on /dev/sda7) OpenSUSE installed on /dev/sda7, provided
Advanced options for openSUSE 42.1 (x86_64) (on /dev/sda7) you installed Grub to sda7 or moved it as
Manjaro Linux (15.12) (on /dev/sdaS)
Advanced options for Manjaro Linux (15.12) (on /dev/sda8) above, add this to the file:
Fedora 23 (x86_64) (on /dev/sda9) menuentry “Load openSUSE boot menu” {
Advanced options for Fedora 23 (x86_64) (on /dev/sda9)
set root=(hd0,7)
System Rescue Cd 4.7.0
chainloader +1
}
Remember, Grub numbers disks from zero
but partitions from one, so sda7 becomes
hd0,8. This gives you the original boot menu
Rescue systems
One of the neat features of Grub 2 is that it can custom and add the appropriate menu set root='(hdO,l)’
boot directly from an ISO image. Apart from definition. Here’s an example for System Rescue isofile=/Ubuntu/ubuntu-15.10-desktop-amd64.
allowing magazines to produce really nice multi CD (I always keep an ISO of that in boot): iso
boot cover discs, it also means you can have a set root='(hdO,l)’ loopback ioop $isofile
rescue or live CD always ready to boot. Not only menuentry “System Rescue CD 4.7.0” { menuentry “Ubuntu 15.10” {
is it faster than booting from an actual CD/DVD loopback loop /systemrescuecd-x86-4.7.0.iso linux (loop)/casper/vmlinu2.efi file=/
(or even a USB stick) but it saves all the time linux (loop)/isolinux/altker64 cdrom/preseed/ubuntu.seed boot=casper iso-
scrabbling though the stuff on your desk to find rootpass=something setkmap=uk scan/filename=$isofile quiet splash —
the right CD. isoloop=systemrescuecd-x86-4.7.0.iso initrd (loop)/casper/initrd.lz
This requires that the distro supports booting initrd iloop)/isolinux/initram.igz }
from an ISO. Most do. although the syntax can } Note the use of a variable, isofile , both
vary. All you need to do is create a copy of 4O_ and here is one for an Ubuntu live CD image methods work but this one is easier to maintain.
Sharing space
So we have several distros that are co-existing
in harmony, but what about our data? Do we
really need a separate home directory for
each distro? The short answer to that is yes.
While we could have a separate filesystem for You may find your installer allows you to use less than all of the available space for your
home and share the same user name and installation, saving the trouble of resizing in GParted later on.
home directory, this is likely to cause conflicts. To do this we need to go back to GParted and so on. Now when you save a file in
Programs store their configuration files in your and resize your partitions to make space to Documents, it will actually go to /mnt/
home directory, and if two of your distros have create a large partition for your data. Then common/Documents and be available to all
different versions of the same program you edit /etc/fstab on each distro to mount this your distros. Note: This assumes you are the
could have problems. Most software will filesystem at boot time. Incidentally, it is only user of the computer.
happily read the settings from an older version worth adding fstab entries to mount your
and update them, but then when you switch other distros in each one, say at Who owns what?
back to the distro with the older version, it /mnt/distroname - it makes things like this Now we have to tackle the thorny issue of file
could break. easier as you can do all the work in one distro. permissions and ownership. The first thing to
One solution is to have a separate It also makes accessing files from other do is make sure that the directories in
filesystem for your data files, these are what distros simple. So have this new filesystem /mnt/common have the correct owners with:
take up the space and are the files that you mount at. say, /mnt/common and create a $ sudo chown -R username: /mnt/common/
want available to all distros. This can be an directory in it for each user. Then you can user
entirely separate filesystem, but it could also create symbolic links to here in your other You may expect this to work for all your
be your home directory in your primary distro, distros, for example: distros if you created a user with the same
just remember that in this case you will have a $ In -s /mnt/common/user/Documents /home/ name in each of them, but it may not. This is
lot of file shuffling to do before you can user/Documents because Linux filesystems don't care about
consider deleting that distro should it fall out $ In -s /mnt/common/user/Music /home/user/ usernames but rather those users' numerical
of favour with you. Music user IDs (UIDs). Most distros give the first user
a UID of 1000, but a couple still start at 500,
*fstab (/etc) - gedit _ + x so check your UID in each distro with the id
File Edit View Search Tools Documents Help command, just run it in a terminal with no
£! Open ▼ □= Save @ r* Undo ' iD 6 Q, arguments. If they all match then great,
otherwise you will need to change any non
1.-1 *fscab *
matching UIDs by editing /etc/passwd. Never
# Use 'blkid1 to print the universally unique identifier for a edit this file directly, a mistake could prevent
# device; this may be used with UUID= as a more robust way to name devices
anyone logging in, use the vipwcommand
# that works even if disks are added and removed. See fstab(5).
# instead $ sudo vipw.
# <file system> <mount point> <type> <options> <dump> <pass> Find the line for your user, which will look
# I was on /dev/sda5 during installation something like this
UUID=5743aec8-5642-4fbe-8a0f-c547218372db / ext4 user:x:500:100::/home/user:/bin/bash
errors=remount-ro 0 1
The first number is the UID. Change it to
# swap was on /dev/sda6 during installation
UUID=be7af5ae-c75f-457f-b22a-b7ddf9e00554 none Swap match the other distros and save the file. Next,
sw 0 0 need to change all files owned by the old UID
/dev/fd0 /media/floppyO auto rw,user,noauto,exec,utf8 0 0 to the new one. As everything in your home
directory should be owned by you, you can
/dev/sdab /mnt/common ext4 noatime 0 0
/dev/sda7 /mnt/opensuse ext4 noatime 0 0
take the brute force approach and chown
/dev/sda8 /mnt/manjaro ext4 noatime 0 0 everything in there
/dev/sda9 ZmntZfedora ext4 noatime 0 0 $cd
/dev/sdal ZmntZwindows ntfs defaults) 0 0 $ sudo chown -R username:.
Now you can switch between distros any
Plain Tert ▼ Tab Width: 8 T tn 18. Col 49 INS
r *»)) 0 12:13 Q1|
time you reboot, with each distro running
Menu M 0Terminal fpfstab (/etc)-gedit 1 /
natively and at full speed, and all with access
> For easier management add entries to /etc/fstab to mount your distros* root partitions. to all of your data. ■
» C * O O
Places
■ D«
|/home/mike
you use it to modify the standard Ubuntu installation ISO and ClRut
bend it to your will in terms of content and aesthetics. 1 Documents
Linux for so long as the defaults were always usable in our experience. We’ll
that he spins it like a start with the simplest example of
record, right 'ound,
just adding some new packages and rebuilding the
baby. Right round,
ISO. This modified ISO can be used as an installer or
round, round.
as a live desktop environment. > We added the LXDE desktop to a standard Ubuntu
Once that's working, we'll show you how to customise it installation ISO. We also added a custom default
further by making LXDE the default desktop environment, backdrop for all new users.
customising that environment and adding some PPAs so privileges, unlike some tools of this sort.
that it really does feel like The first page of the Cubic user interface enables you
its your own personal spin on how Linux should look to specify the project directory. Cubic doesn’t run any tests
and work. for free space itself, and you'll need quite a lot of space for
the uncompressed ISO. The Ubuntu Desktop installation
Install Cubic ISO may weigh in at around 2.7GB, but its actual content is
Cubic expects to run under Ubuntu or Linux Mint about double that as it’s compressed using Squashfs. We’d
or one of their derivatives. If you are running a different recommend having at least 20GB free before you begin
distribution, you can still use Cubic and follow this tutorial using Cubic.
by running Ubuntu in a VM. Begin by installing from PPA. To The decompressing and recompressing of an ISO is
do this, locate the Cubic page on Launchpad (https:// rather time-consuming and an SSD works faster than
When you modify launchpad.net/cubic) and follow the instructions by a mechanical hard drive for this task. One way of speeding
an Ubuntu cutting and pasting the needed commands from that page, things up is to leave the project directory intact between
distribution that
sudo apt-add-repository ppa:cubic-wizard/release different build attempts.
makes use of a live
CD environment,
adds the repository to your system, sudo apt update This way. the decompression stage of the process only
using Cubic you're updates the system so that it can see contents of the Cubic has to be carried out once, and you keep the changes
also modifying the PPA. sudo apt install -no-install-recommends cubic mn you've already made. Delete the folder and start again if you
live environment. adds Cubic itself. Other than that, the installation should want a true fresh start at modifying
This means that
then take care of itself in terms the ISO.
Cubic is perfect for
making a bootable of dependencies. Having specified the working directory for the project,
ISO with some extra The next step is to obtain an up-to-date Ubuntu press Next to proceed to the next page, the Project page.
tools on it. All you installation ISO to work with. We’ll use Ubuntu 21.04, Click the icon next to the filename field and specify the
need to do is select
but 20.04 LTS (Long Term Service) is a good choice as well. base ISO that you plan to use as your starting point for
Try Ubuntu when it
Launch Cubic in the normal way that you launch GUI apps customisations. Once you’ve done that, most of the fields
startsup.
or load it in a terminal window for extra progress on this page will be filled in automatically, but you can safely
information. When running, Cubic requires no super-user change things like
Build your own custom Ubuntu distro
Cubic Documentation
The documentation for Cubic is rather limited as Cubic is quite a well-known program and it's
0 Cubic
it's concentrated on the Launchpad page for the been around for a number of years, so web Overview Code Bugs Blueprints Translations
project. The two areas that provide the most searches tend to be fruitful. For example,
Questions for Cubic
information are the Answers and FAQs sections. searching on askubuntu.com produces a lot of
by relevancy ■ Search
The Answers section shows a good (but not useful information. However, check the age of Languages fitter (Change your preferred languages)
o English (en)
massive) level of activity and it helps that it's posts as they stretch back quite a long way and Status
oOpen a Needs information o Answered o Solved Expired invalid
searchable too. The main Cubic developer might not be applicable to the version of Ubuntu
Summary Created Sob
is highly active on this forum-like section of the that you are using. A few YouTube videos covering • 698512 Cannot bot ISO FMe generated with Cubk 2021 -08-25 1 Je
Launchpad page, often offering highly detailed the basics exist. We feel that a lack of plentiful, 2021.06-52-
answers. This means that the information is there, traditional documentation is probably the weakest > Asking around on the Launchpad is
but it's quite a lotof work to search for it. point of the overall Cubic experience. probably your best bet for answers.
Custom PPAs
Users and wallpapers You can add debs and PPAs to Ubuntu in the normal way
Whenever a distribution like Ubuntu creates a new user it that you'd expect, using the chroot environment
creates a directory for that user and populates it with the on the Terminal page. So, for example, you could add
contents of the /etc/skel directory. Let's look at a case the Inkscape PPA and install Inkscape by typing:
where you want to give the user a custom backdrop image add-apt-repository ppa:inkscape.dev/stable
as soon as they log in for the first time. apt install inkscape
The snag is that different desktop environments use This means that Inkscape will now be installed from the
different methods to display the background image. This is get go, and when you update the system, the updated
a method that will work for LXDE. In the case versions will be pulled from the PPA rather
of LXDE. the file manager (PCManFM) draws the backdrop. than the Ubuntu repository. Do something like apt-cache
To begin the process try customising the LXDE desktop in a policy and cut and paste that into a text file if you want to
running VM, and set the backdrop image to something in keep a complete list of every repository you've added to the
the /usr/share/backgrounds/ directory. Having done this, system as a reminder for future respins.
copy the configuration file from its location within the home Add downloaded debs to the chroot environment
directory (-/.config/pcmanfm/LXDE/desktop-items-O. and install them with dpkg -i [name of .deb]. Nearly
conf). The parameter within this file happens to be everything will work, but occasionally something requires a
‘wallpapei=’ and you can edit it by hand if you want to. service that the chroot environment can't provide. As is the
On the other side, copy the files to the filesystem of the case with customising the user home directory, as detailed
Cubic chroot environment using the 'copy' icon at the top of earlier, if you can't automate the installation, you could copy
the Terminal page. Place the image in the same place as the .deb files manually and add a small post-install script, to
before by typing cd /usr/share/backgrounds/ and using the be invoked manually, to install them.
copy icon at the top. Happy respins!
Recreate the config directory structure and move into
that directory with:
cd /etc/skel
mkdir -p .config/pcmanfm/LXDE
cd .config/pcmanfm/LXDE
Following this, copy the desktop-items-O.conf file into
this directory using the copy icon.
There's quite a lot of potential here to pre-customise the
user environment using the method of customising in a
VM and then copying the configuration files. For example,
let's say that you were producing a custom installation ISO
for a college. In such a case, you might place a welcome
pack of useful files (PDFs, images, etc) into the home
directory. To do this, just place those files into /etc/skel
using the Cubic interface.
All of the splash screens, such as the startup screen,
used by Ubuntu Linux use a system called Plymouth.
Customising Plymouth is a lengthy topic in itself
as there are so many files that you can modify, and together
these constitute a theme. The easiest way to get started The ISO generation screen. This is a time-consuming process and memory and
with customising the splash screens is to browse the CPU usage will peak while it’s going on.
LTTng: Tracing
apps in Linux
It’s time to introduce the essentials of software tracing and how to
use LTTng for understanding what’s happening on a running system.
2. mtsouk@LTTng: - (ssh)
mtsouk@LTTng:~$ sudo apt-get install Ittng-tools Ittng-modules-dkms liblttng-ust-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
liblttng-ust-dev Ittng-modules-dkms Ittng-tools
0 upgraded, 3 newly installed, 0 to remove and 215 not upgraded.
Ubuntu 16.04
Need to get 0 B/873 kB of archives.
requires Ittng-tools,
After this operation, 6,191 kB of additional disk space will be used.
Ittng-modules-dkms Selecting previously unselected package liblttng-ust-dev;amd64.
and liblttng-ust-dev (Reading database ... 175696 files and directories currently installed.)
for LTTng to run Preparing to unpack ..,/liblttng-ust-dev_2.7.1-l_amd64.deb ...
properly. Unpacking liblttng-ust-dev:amd64 (2.7.1-1) ...
Selecting previously unselected package Ittng-modules-dkms.
Preparing to unpack ..,/lttng-modules-dkms_2.7.1-l_all.deb ...
Unpacking Ittng-modules-dkms (2.7.1-1) ...
Selecting previously unselected package Ittng-tools.
Preparing to unpack .../Ittng-tools_2.7.1-2~fakesyncl_amd64.deb ...
Unpacking Ittng-tools (2.7.1-2~fakesyncl) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu4) ...
Setting up liblttng-ust-dev:amd64 (2.7.1-1) ...
Setting up Ittng-modules-dkms (2.7.1-1) ...
Loading new lttng-modules-2.7.1 DKMS files...
First Installation: checking all kernels...
Building only for 4.4.0-21-generic
Building initial module for 4.4.0-21-generic
Done._____________________________________________________________________________________________
TTng is an open source tracing framework that runs on (which are hardcoded at specific locations in the source
Software tracing
is the process of
understanding
L Linux. This enables you to understand the interactions
between multiple components of a system, such as the
kernel, C or C++, Java and Python applications. On the
Ubuntu 16.04 distro you can install LTTngaz follows:
code), and automatic (which are dynamically executed when
something specific happens). Controlling tracing is what you
can do using the Ittng command line utility. The following
command displays all available tracing events related to the
$ sudo apt-get install Ittng-tools Ittng-modules-dkms liblttng- Linux kernel:
what's happening
on a running ust-dev $ sudo Ittng list -kernel
software system. After a successful install you will see at least one process $ sudo Ittng list -kernel I wc
A trace application related to LTTng running (see above right for how the 234 1389 17062
can trace both
installation process looks in more detail): (You can see a small part of the output from Ittng list
user applications
# ps ax I grep -i Itt I grep -v grep -kernel. bottom right). If the previous commands fail then
and the OS at the
same time. If you're 3929 ? Ssl 0:00 /usr/bin/lttng-sessiond there’s a chance that the LTTng kernel module isn’t running,
an amateur Linux You can find the version of LTTng you are using with: which you can check with: $ Ismod I grep -i Itt.
user, you may find $ Ittng -version In that case, you can start LTTngas follows:
tracing difficult
Ittng (LTTng Trace Control) 2.7.1 - Herbe a Detoume $ sudo /etc/init.d/lttng-sessiond start
to understand, so
try using simple [ ok ] Starting Ittng-sessiond (via systemctl): Ittng-sessiond.
examples until it Using LTTng service.
makes more sense. LTTngdoes two main things: instrumenting and controlling If you try to run the LTTng list command without root
tracing. Instrumenting is the task of inserting probes into privileges, you will get an error message instead of the
source code, and there are two types of probes: manual, expected output:
$ Ittng list -kernel The above command must be executed at a specific time
Error: Unable to list kernel events: No session daemon is and the list of commands you’ll need to execute must follow
available this order:
Error: Command error $ Ittng create demo_session The philosophy of
Should you wish to avoid running all LTTng-related $ Ittng enable-event -a -k tracing is similar
> As the output | < 2- mtsoukgLTTng: -/code/lttnt (ssti) However, in this case, the syscall_exit_open trace point is
mtsouk#LTTng:~/code/lttngS bobeltrace ~/lttng-traces/demosession 20160615-154836 2>/de
of babeltrace v/null I wc more useful, because it also shows the return value of the
3925739 80655724 547584568
is in plain text mtsouk€LTing:~/code/lttng$ bobeltrace ~/lttng-traces/demo_session-20160615-154836 2>/de open(2) system call:
v/null I grep syscoll. I awk {'print $4'} I sort I uniq *c I sort -rn I hood
format, you can 86623 syscall.entry.recvmsg: $ babeltrace ~/lttng-traces/demo_session-20160615-154836
86619 syscaU_exit_recvmsg:
use any text 86265 $y$call_entry_setiti«er: 2>/dev/null I grep syscall_exit_open I grep “ret = -1”
processing tool 86260 syscall_exit_setitimer:
47561 syscall_exit_select: [15:49:17.175257726] (-K).000000719) LTTng syscall_exit_
to investigate a 47548 syscoll.entry-select:
#endif/* _HELLO_TP_H 7
#include <lttng/tracepoint-event.h>
This is saved as fibo-lttng.h and defines a new trace event
The BabelTrace tool F
with a full name of fibo:tracing_fibo . The input_integer_field BabelTrace is a tool that helps you deal you to convert from a text log to CTF
is the text that will be written in the trace files. According to with various trace files, including the but you will not need it if you are only
trace files generated by LTTng. It allows dealing with LTTng.
the C standard, the size_t type, used in both fibo-lttng.h and
you to read, write and convert trace files You can learn more about babeltrace
fibo.c. is an unsigned integer type of at least 16-bit.
using the Common Trace Format (CTF) at http://diamon.org/babeltrace
You are also going to need a file named fibo-lttng.c:
and is very useful for presenting CTF You could also try using Trace Compass
tfdefine TRACEPOINTJ2REATE_PROBES files onscreen. If BabelTrace isn't (http:y7tracecompass.org) to view
#define TRACEPOINT_DEFINE already installed, you can get it with: LTTngtrace files, which is a graphical
$ sudo apt-get install babeltrace application. You can also learn
^include “fibo-lttng.h” The babeltrace-log utility that comes more about the CTF format at
The main purpose of fibo-lttng.c is to have fibo-lttng.h with the babeltrace package enables http://diamon.org/ctf.
included in it in order to compile it:
$ gcc -Wall -c -I. fibo-lttng.c The last thing to do before executing traceMex is to
$ Is -1 fibo-lttng.* compile it:
-rw-rw-r- 1 mtsouk mtsouk 84 Jun 17 19:09 fibo-lttng.c $ gcc -c traceMe.c
-rw-rw-r- 1 mtsouk mtsouk 497 Jim 17 19:11 fibo-lttng.h $ gcc -o traceMe traceMe.o fibo-lttng.o -Idl -llttng-ust
-rw-rw-r- 1 mtsouk mtsouk 11600 Jun 17 19:12 fibo-lttng.o You should enable the trace event defined in fibo-lttng.h
So, now that you have fibo-lttng.o. you are ready to make after starting a tracing session:
the necessary changes to fibo.c and compile it. The final $ Ittng create fibo_session
version of fibox will be saved as traceMex. This output uses $ Ittng enable-event -userspace fibo:tracing_fibo
the diff command to show the differences between fibo.c After starting the new session, you can finally execute
and traceMex: traceMex. allow it to finish and stop the tracing process:
$ diff fibo.c traceMe.c $ Ittng start
la2,3 $ ,/traceMe
> //include <unistd.h> $ Ittng stop
> //include “fibo-lttng.h" $ Ittng destroy
4a7 Running the command (below) while ,/traceMe is still
> tracepointffibo, tracingjfibo, n); being executed will reveal all available user space trace
11C14 events, including the one you declared in fibo-lttng.h:
< return (fibonacci(n-l)+fibonacci(n-2)); $ Ittng list "userspace
In order to get any output from this, the traceMex
> return (fibonacci(n-l)+fibonacci(n-2)); executable must be running—this is the reason for calling
16a20 sleep(l) in traceMex. (See the output below).
> sleep(lO); The data from the trace can be found at -/Ittng-traces/
20a25 fibo_session-20160617-193031 As traceMex uses a
recursive function, its output has 5,151 lines, but usually you
As you can see. you must include one extra header file - will get less output when tracing a single event.
the one you created earlier - as well as an extra tracepointQ .
You can call tracepointQ as many times as you want Analysing C code
anywhere in the C code. The first parameter of tracepointQ is The output of babeltrace would be similar to the following:
the name of the provider, the second is the name of the trace $ babeltrace ~/lttng-traces/fibo_session-20160617-193031
point, and the rest is the list of parameters you're [19:31:26.857710729] (+?.?????????) LTTng fibo:tracing_fibo:
inspecting—in this case, you are inspecting just one variable. {cpu_id = 0}, {input_integer_field = 0}
[19:31:26.857753542] (+0.000042813) LTTng fibo:tracing_fibo:
2. mttouk^LTTnfl; -/code/Utofl (uh)
mtsoukR.TTng:~/code/lttng$ bobeltroce ~/lttng-traces/fibo_session-20160617-193031 I aMc {’p
{cpujd = 0}, {inputJnteger_field = 1}
rint $13’} I $prt I uniq -c I sort -m
15% 2
$ babeltrace ~/lttng-traces/fibo_session-20160617-1930311
987 1
986 3
wc
609 4
376 5
5151 72114 540934
232 6
143 7 An awk script will reveal the number of times traceMex
88 8
549 calculates each Fibonacci number:
33 10
20 11 $ babeltrace ~/lttng-traces/fibo_session-20160617-1930311
12 12
7 13 awk {'print $13'} I sort I uniq -c I sort -m
4 14
2 15 (The output can be seen, left), as you can understand.
1 16
1 0 traceMe.c needs to be optimised! If you want to trace Python
mtsoukR.TTng:~/code/lttnq$ ./troceMe
9; 0 applications, you will need to install one extra package:
1: 1
2: 1 $ pip search Ittn
3: 2
4: 3 Ittnganalyses - LTTng analyses
5: 5
6: 8 Ittngust - LTTng-UST Python agent
7: 13
$ sudo pip install Ittngust
Here we are processing the output of traceMe.c Tracing Python code is beyond the scope of this tutorial
using babeltrace which reveals that there is a serious but you can learn more about it at http://lttng.org/
performance problem in traceMe.c. docs/#doc-python-application. ■
Grub: Boot
ISOs from USB
An easy way to avoid a bag full of DVDs is by copying them all to one USB
stick, along with a convenient menu to pick which one to boot.
lmost all of the distribution (distro) ISO files on cover least for the poor sap having to get the DVD working, is that
with dd. The USB stick will then boot as if it were a DVD. This
different distros need to be treated differently and the options
to boot from them as ISOs is rarely documented.
the normal way but they can also be copied to a USB stick In the next few pages, we will show you how to do this;
how to set up a USB stick in the first place and the options
is a handy way of creating install discs for computers that you need for the favourite distros. We will also show you how
don't have an optical drive, but it has one significant to deal with less co-operative distros.
drawback; Each ISO image requires a USB flash drive to itself.
With USB sticks holding tens or even hundreds of gigabytes Setting up the USB stick
costing only a few pounds, and small drives becoming harder First, we need to format the stick. We will assume that the
to find, this is a waste of space both on the stick and in your stick is set up with a single partition, although you could use
pocket or computer bag. Wouldn't it be good to be able to put the first partition of a multi-partition layout. What you cannot
several ISO files on the same USB stick and choose which get away with is a stick formatted with no partition table, as
one to boot? Not only is this more convenient than a handful some are. If that's the case, use fdisk or GParted to partition
of USB sticks, it's both faster and more compact than a the drive, then you can create the filesystem. The choice of
handful of DVDs. filesystem is largely up to you, as long as it is something that
The good news is that this is possible with most distros, Grub can read.
and the clue to how it's done is on our cover DVDs each We've used FAT and ext2 (there’s no point in using the
month. We used to laboriously unpack distro ISOs onto the journalling ext3 or ext4 on a flash drive). Use whatever fits in
DVD so that we could boot them and then we had to include with your other planned uses of the drive, we generally stick
scripts to reconstruct the ISO files for those that wanted to with FAT as it means we can download and add ISO images
burn a single distro to a disc. Then we started using Grub to from a Windows computer if necessary. Whatever you use
boot the DVD, which has features that make booting from ISO give the filesystem a label, we used MULTIBOOT, as it will be
files possible. The main disadvantage of this approach, at important later.
Use GParted
or one of the
command-line
tools to prepare
your flash drive.
Giving the
filesystem a label
is important for
booting some
distros ISOs.
EFI booting
In this instance, we've created a flash portable option, but if you need to boot boot /dev/sde
drive that uses the old style MBR booting. your stick using UEFI, change the grub- This is a 64-bit target, as UEFI is only
While most computers of the last few install command to use the UEFI target, fully supported on 64-bit hardware. If
years use UEFI, they still have a like this: you want to use your USB stick with
compatibility mode to boot from an MBR. $ sudo grub-install --target=x86_54-efi 32-bit equipment, stick (sorry) with the
So this makes our stick the most -boot-directory=/media/MULTIBOOT/ MBR booting method.
Fedora 24
make it bootable:
Arch Linux
$ mkdir -p /media/MULTIBOOT/boot
Adding System Rescue Cd 4.8.1
$ sudo grub-install -target=i386-pc -boot-directory=/media/ Ultimate Boot CO S.3.S
MULTIBOOT/boot /dev/sde
Note: the boot-directory option points to the folder that
will contain the Grub files but the device name you give is the
whole stick, not the partition. Now we create a Grub
configuration file with:
$ grub-mkconfig -o /media/MULTIBOOT/boot/grub/grub.cfg
This will create a configuration to boot the distros on your
hard drive, so load grub.cfg into an editor and remove
everything after the line that says:
### END /etc/grub.d/OO_header ###
Press enter to boot the selected OS, e' to edit the commands before booting or 'c' for a command-li
Adding a distro
This gives us a bare configuration file with no menu entries. initrd (loop)/casper/initrd.lz > If you are
creating a flash
If we booted from this stick now. we would be dropped into a }
drive to share,
Grub shell, so let's add a menu. We'll start with an Ubuntu ISO menuentry "Install Ubuntu 16.04" {
you may want
because they are popular (sorry, but they are) and because linux (loop)/casper/vmlinuz.efi file=/cdrom/preseed/
to look at the
they make booting from an ISO file easy (after all, it's Ubuntu, ubuntu.seed boot=casper iso-scan/filename=$isofile only- theme section
it makes most things easy). Load grub.cfg back into ycur ubiquity quiet splash — of the Grub
editor and add this to the end of the file: initrd (loop)/casper/initrd.lz manual to make
submenu "Ubuntu 16.04" { } your boot screen
set isofile=/Ubuntu/ubuntu- 16.04-desktop-amd64.iso } look prettier.
loopback loop $isofile Create the Ubuntu directory on the drive and copy over
menuentry "Try Ubuntu 16.04 without installing" { the ISO file. Then unmount the drive and reboot from the
linux (loop)/casper/vmlinuz.efi file=/cdrom/preseed/ stick. You should see a Grub menu with one entry for Ubuntu
ubuntu.seed boot=casper iso-scan/filename=$isofile quiet that opens up to reveal boot and install options,
splash —
Special options
The first line creates a variable containing the path to the ISO
file. We use a variable because it means we only need to make
one change when we want to adapt the menu to a different
release. The second line tells Grub to mount that as a loop
device (a way of mounting a file as if it were a block device).
Then we have the two menu entries. You may be wondering
how do we know what options to add to the menu entries.
That comes from a combination of looking at the ISO’s
original boot menu and knowing what to add for an ISO boot.
The latter, in the case of Ubuntu, is to add
iso-scan/filename=$isofile
where the variable isofile was set to the path to the file a
use the I and I keys to select which entry is highlighted.
Press enten to boot the selected OS. e' to edit the cowaods befo/e booting o^ t'
for a command-line.
couple of lines earlier. To see the original boot menu, we need
to mount the ISO file, which is done like this:
$ sudo mount -o loop /path/to/iso /mnt/somewhere
> This is the basic menu you get with a default Grub Most ISOs use isolinux to boot so you need to look at the
configuration—functional but not very pretty. CFG files in the isolinux or boot/isolinux directory of your »
Getting tricky
What do you do if you want to boot an ISO for which we don't
> If you want, you can tweak your menus. The Grub online manual shows all the have a recipe? You could try a web search, but if that doesn't
options. The SystemRescueCd example on the DVD uses one such command to show up anything useful, you can examine the ISO's boot
only show the 64-bit options when relevant. process directly. Almost all Linux distros use an initramfs to
root=*)
R00T=${x#root=]
if [ -z "${B00T}" ] && [ "SROOT" = "/dev/nfs" ]; then
B00T=nfs
fi
rootflags=‘)
R00TFLAGS="-o ${x#rootflags=}"
rootfstype=*)
ROOTFSTYPE="${x#rootfstype=}"
rootdelay=‘)
ROOTDELAY="${x#rootdelay=}"
case ${R00TDELAY) in
*[![:digit:].]*)
R00TDELAY=
esac
resumedelay=*)
RESUMEDELAY="${x#resumedelay=}"
loop=*)
L00P="${x#loop=}"
- MOST: /Ixfdvd/work/init_________________________________________________________________________________ (78,1) 29%
Press 'Q' to quit, H' for help, and SPACE to scroll.
Examining the init file in the ISO's initrd file can reveal extra options available to the boot menu.
MM MM M M M
M M M
^m ^^k Ik I ^m ^^k
I^A^bI M M MW M M
IM MI M M M M ■
^M
I ^M I m I m M I
nprocessable_er1 ^MMIM rate $ bundle exec rake db:migrate $
mm^^mmb JBMMBB|B Mpp^M|
| M
M MMMMB M MMM JM|^^^^Mf
ite_attributes(params[:task]) format.html M Ms! :oM M M^lse format.html {render action: "edit”} format.json {rei
ec rails generate migration add_priority_to_tasks prioritydnteger $ bundle exec rake db:migrate $ bundle exec rake db:migrate $ bundle exec rails server validate
at, ‘is in the past!’) if due_at < Time.zone.now #!/usr/bin/en python import pygame from random import randrange MAX_STARS = 100 pygame.init() screen = py
ars = for i in range(MAX_STARS): star = [randrange(O,639), randrange(0,479), randrange(l, 16)] stars.append(star) while True: clock.tick(30) for event in pygame.
numstars = 100; use Time::HiRes qw(usleep); use Curses; $screen = new Curses; noecho; curs_set(0); for (Si = 0; Si < Snumstars ; $i++) {$star_x($i] = rand(80); $s
clear; for ($i = 0; $i < Snumstars ; $i++) {$star_x($i] -= $star_s[$i]; if ($star_x($i] < 0) {$star_x($i] = 80;} $screen->addch($star_y($i], $star_x($i], “.”);} $screen->refre
rent, lest do gem “rspec-rails”, “~> 2.13.0” S gem install bundle: $ gem install rails -version=3.2.12 $ rbenv rehash $ rails new todolist -skip-test-unit respond
nl {redirect_to @task, notice: } formatjson {head :no_content} else format.html {render action: “edit”} format.json {render json: @task.errors, status: :unprc
ity_to_tasks priority:integer $ bundle exec rake db:migrate $ bundle exec rake db:migrate $ bundle exec rails server validate :due_at_is_in_the_past def due_at_is_
jne.now #!/usr/bin/en python import pygame from random import randrange MAX_STARS = 100 pygame.init() screen = pygame.display.set_mode((640, 480)) c
star = [randrange(0, 639), randrange(0, 479), randrangefl, 16)] stars.append(star) while True: clock.tick(30) for event in pygame.event.get(): if event.type == pyg
tes qw(usleep); use Curses; Sscreen = new Curses; noecho; curs_set(0); for ($i = 0; $i < Snumstars ; $i++) {$star_x[$i] = rand(80); $star_y($i] = rand(24); $star_s[$i]
s ; $i++) { $star_x($i] -= $star_s[$i]; if ($star_x($i] < 0) { $star_x[$i] = 80;} Sscreen->addch($star_y[$i], $star_x($i], “.”);} $screen->refresh; usleep 50000; gem “then
Is”, “~> 2.13.0” $ gem install bundler $ gem install rails -version=3.2.12 $ rbenv rehash $ rails new todolist -skip-test-unit respond_to do Iformatl if @task.update_
’) format.json {head :no_content} else format.html {render action: “edit”} format.json {render json: @task.errors, status: :unprocessable_entity} $ bundle exec rails
exec rake db:migrate $ bundle exec rake db:migrate $ bundle exec rails server validate :due_at_is_in_the_past def due_at_is_in_the_past errors.add(:due_at, ‘is in tt
rgame from random import randrange MAX.STARS = 100 pygame.init() screen = pygame.display.set_mode((640, 480)) clock = pygame.time.Clock() stars = :
s(0, 479), randrange(l, 16)] stars.append(star) while True: clock.tick(30) for event in pygame.event.get(): if event.type = pygame.QUIT: exit(O) #!/usr/bin/perl $nt
; new Curses; noecho: curs_set(0); for ($i = 0; $i < $numstars ; $i++) { $star_x($i] = rand(80); $star_y[$i] = rand(24); $star_s[$i] = rand(4) + 1;} while (1) { Sscreen-
]; if ($star_x[$i] < 0) { $star_x($i] = 80;} $screen->addch($star_y[$i], $star_x[$i], “.”);} $screen->refresh; usleep 50000; gem “therubyracer”, “~> 0.11.4” group :de\
ndler $ gem install rails -version=3.2.12 $ rbenv rehash $ rails new todolist --skip-test-unit respond_to do Iformatl if @task.update_attributes(params[:task]) forma'
nt} else format.html {render action: “edit”} format.json {render json: @task.errors, status: :unprocessable_entity} $ bundle exec rails generate migration add_priori1
exec rake db:migrate S bundle exec rails server validate :due_at_is_in_the_past def due_at_is_in_the_past errors.add(:due_at, ‘is in the past!’) if due_at < Time.zon
ndrange MAXJSTARS = 100 pygame.init() screen = pygame.display.set_mode((640, 480)) clock = pygame.time.Clock() stars = for i in range(MAX_STARS): star =
=nd(star) while True: clock.tick(30) for event in pygame.event.get(): if event.type = pygame.QUIT: exit(O) #!/usr/bin/perl $numstars = 100; use Time::HiRes qw(us
($i = 0; $i < Snumstars ; $i++) { $star_x[$i] = rand(80); $star_y{$i] = rand(24); $star_s[$i] = rand(4) + 1;} while (1) { $screen->clear; for ($i = 0; $i < Snumstars ; $i++)
reen->addch($star_y]Si], $star_x[$i], “.”);} $screen->refresh; usleep 50000; gem “therubyracer”, “~> 0.11.4” group development, lest do gem “rspec-rails”, “~> 2.13.0
The terminal
Feel like a 1337 hacker and get to
grips with the powerful terminal.
126 Get started
The best way to use the terminal is to dive
in with both feet and start using it.
Terminal: How
to get started
It's time to flex your fingers and dive head first into the inky darkness of the
terminal to see how you can start handling the commands.
he terminal is an incredibly important part of your emulator - technically it’s emulating a TeleTYpe (TTY)
If you're struggling
to type the right
T Linux desktop. It doesn't matter how wedded you are
to point and click over the command line, at some
session. It has all the functionality you'll need, but both XTerm
and UXTerm are worth noting because although they are
point you're going to have to dip your toe in the terminal's more minimalist tools and neither require any dependencies
dark expanse and use it. Don't worry, though, because the to run. This means if anything stops the main terminal from
command,you can
terminal isn't as scary as it might appear, and if you take the running, you can use either as a backup. As an aside, the only
wipe all previous
time to learn the basics you'll discover it can be a far quicker difference between the two is that UXTerm supports the
actions from view
simply by typing and more effective way of getting certain tasks done. expanded Unicode character set.
clear and hitting As you'd expect, a terminal effectively gives you access to
Enter. Note this your Linux shell, which means it works in exactly the same How Bash works
won't affect your
way using the same language (Bash). This means you can do The Linux shell uses the Bash shell and command language
command history.
anything in the terminal you'd normally do at the command to perform tasks, and it uses a relatively straightforward
line, all without leaving the relative comfort of your desktop. syntax for each command: utility command -option .
That makes learning how to use the terminal - and Bash - The 'utility' portion of the command is the tool you wish to
doubly advantageous as it gives you your first glimpse into run, such as Is for listing the contents of a directory, or apt-
working with the underlying Linux shell. And over the next few get to trigger the APT package management tool. The
articles that's exactly what you’re going to learn - how to get command section is where you specify exactly what you
to grips with the terminal. want the utility to do, eg typing apt-get install instructs the
We're basing this tutorial on Ubuntu, so start by opening package management utility to install the named package, eg:
the Dash and typing 'terminal' into the search box. You'll find apt-get install vic.
the terminal of course, but you'll also see two entries called The -option section is where one or more ‘flags' can be
UXTerm and XTerm too. This highlights the fact there are set to specify certain preferences. Each flag is preceded by
multiple terminal emulators that you can run in order to
interact with the shell. There are differences between them, of
course, but fundamentally they do the same thing. Speed up text entry
For the purposes of this tutorial we're sticking with the
default terminal, which is basically the gnome-terminal It doesn't matter how fleet of hand your typing skills are. the
command line can still be a time-consuming, frustrating
experience. Thankfully the terminal comes equipped with
lots of handy time-saving shortcuts. This issue let's take a
look at how you can easily access previously used
commands and view suggestions:
» Up/down arrows Browse your command history.
» history Use this to view your command history
» Ctrl+r Search command history. Type letters to narrow
down search, with the most recent match displayed, and
keep pressing Ctrl+r to view other matches.
» Tab View suggestions or auto-complete a word or path if
only one suggestion exists. Press ~+Tab to autofill your
username, @+Tab to autofill your host name and $+Tab to
> The -help flag can be used with any command to find
autofill a variable.
out what it does, plus what arguments to use.
one or two dashes (--) and the most useful of all is the --help sudo group by default. To resolve this, you need to open the
option, which provides a brief description of the utility, plus terminal in an account that does have root access (or use the
lists all available commands and options, eg Is -1. su command if supported) and type sudo adduser
The -1 flag tells the list directory tool to provide detailed <username> sudo . You can also add the user to other groups
information about the contents of the folder it's listing, with the command by listing all the groups you wish to add.
including: permissions: who owns the file: the date it was last eg: sudo adduser <username> adm sudo Ipadmin
modified: and its size in bytes. Utilities can be run without any sambashare .
commands or options - eg Is on its own provides a basic list Another handy tool is gksudo, which allows you to launch
of all folders and files in a directory. You can also run utilities desktop applications with root privileges. It's of most use
with a combination of commands and/or options. when wanting to use the file manager to browse your system
with root access: gksudo nautilus . Make sure you leave the
Restricted access terminal open while the application is running, otherwise it’ll
Open the terminal and you’ll see something like this appear: close when the terminal does. When you're done, close the
username@pc-name:~$ . This indicates that you’re logged on application window, then press Ctrl+c in the terminal, which
to the shell as your own user account. This means that you interrupts the currently running program and returns you to
have access to a limited number of commands - you can run the command line.
Is directly, eg, but not to install a package using apt-get. We've already discussed the -help flag, but there are
because the command in question requires root access. This other help-related tools you can use too. First, there's
is achieved one of two ways - if you’re an administrative user, whatis - which you can type with any command to get a
as the default user in Ubuntu is. then you can precede your brief description of it and any specified elements, eg whatis
command with the sudo command, eg sudo apt-get install apt-get install vic will describe the apt-gettool. the install
vic . You’ll be prompted for your account password, and then argument and what package vic is. Flags are ignored.
the command will run. You should find that you can run more If you're looking for a full-blown manual, then the man tool
sudo -based commands without being re-prompted for your provides access to your distro's online reference manual,
password (for five minutes) while the terminal is open. On which is started with man intro . This provides you with a long
some distros you can log on to the terminal as the root user and detailed intro to the command line. Once done press q to
with su -you'll be prompted for the root password at which quit back to the terminal. For more advice on navigating the
point you'll see the following prompt: root@pc-name:~$ . manual, type man man or pair it with a tool, eg man Is .
Once logged in, you can enter commands with no Now you've taken your first steps into the world of the
restrictions. We recommend you use the sudo command terminal, check out the box (Your First Terminal Commands,
rathe' than this approach and if you’re running Ubuntu then above) for some useful package management commands
you'll find su won't work because the root account password you can work with. Next issue, we'll look at how to navigate
is locked for security reasons. your filesystem from the terminal, plus launch programs and
When installing some distros or adding new users to delve into more useful shortcuts to help speed up the way
Ubuntu, you may find your user account isn't added to the you interact with the command line. ■
Terminal:
Work with files
Turn your attention to navigating the file system and
manipulating files and folders from the beloved Terminal.
packages and get further help. This time, we're going to look ntck@ntck-ubuntu:-/Docunents$ nkdtr Doctor Who
nick(anick-ubuntu:~/Docunents$ Is
at how you can navigate your file system, work with files Doctor Who
and folders and learn some more time-saving shortcuts in nickgnick-ubuntu:~/DocunentsS rndtr Doctor Who
ntck@ntck-ubuntu:-/Docunents$ Is
the bargain. ntckgntck-ubuntu:~/Docunents$ nkdtr 'Doctor who'
When you open a new Terminal window, the command ntckgntck-ubuntu:-/Docunents$ Is
Doctor Who
prompt automatically places you in your own personal home ntckgntck-ubuntu:«/DocumentsS I
folder. You can verify this using the Is command, which lists
the contents of the current folder. The default Terminal > Make good use of * and \ characters when folder paths
application displays folder names in blue, and filenames in contain spaces and other special characters.
white, helping you differentiate between them. The Is
command can be used in other ways too. Start by typing Is -a <subfolder> with the name of the folder you wish to access.
to display all files, including those tha: begin with a period Remember that folder and filenames are case sensitive, so if
mark (.), which are normally hidden from view. Then try Is the folder begins with a capital letter - as your personal
-recursive , the -recursive option basically means that the Documents folder does, eg - you'll get an error about the
contents of sub-folders are also displayed. folder not existing if you type it all in lower case, eg, cd
If you want more detail about the folder's contents - documents . You can also move down several levels at once
permissions settings, user and group owners, plus file size (in using the following syntax: cd subfolder/subfolder2 . To move
bytes) and date last modified, use Is -1. If you'd prefer to list back up to the previous level, use cd... you can also use the
file sizes in kilobytes, megabytes or even gigabytes depending I character to move up multiple levels at once, eg cd.Z.
on their size, add the -h option—so use Ih -h -1 instead. moves up two levels.
There are many more options for Is and you can use the What if you want to go somewhere completely different?
-help option to list them all. Use cd / to place yourself in the root directory, or navigate
Navigating your file system is done using the cd anywhere on your system by entering the exact path,
command - to move down one level to a sub-folder that’s including that preceding I character to indicate you're
inside the current directory use cd <subfolder> , replacing navigating from the top level, eg cd /media/username .
Speedier navigation
In last part we revealed some handy keyboard arguments. command with sudo applied to it. And if you
shortcuts to help you enter commands more » Ctrl+u Clear the entire line to start again. make a typo when entering a command, instead
quickly, but the following keys will help you » Ctrl+k Delete everything from the cursor's of retyping the entire command again, just use the
navigate the Terminal itself more efficiently: position onwards. following syntax to correct the mistyped word (in
» Home/End Press these to jump to the » Ctrl+w Delete the word before the cursor. the following example, dpkg was originally
beginning or end of the current line. Accidentally omitted sudo from your command? mistyped as dkpg):
» Ctrl+left/right cursor Move quickly between Just type sudo I! and hit Enter to repeat the last AdkpgAdpkg
The ~ character works in a similar way to / .except this Wildcards are often used to speed things up in searches,
places you in your home directory. So typing cd ~/ and can also be applied to file commands too - the asterisk
Documents is the same as typing cd /home/username/ (*) character can be used to quickly access a folder with a
Documents . One final trick —you've jumped to another long name, eg cd Doc*. This works fine if there's only one Somefilemanagers
directory, but how do you go back to the previous directory folder beginning with Doc, but if there ere two (say Doctor allow you to
right-click a folder
quicky? Simple, just type cd - to do so. and Documents), then the command would open the first
and open the
matching folder, which is Doctor in this instance. To avoid Terminal at that
Working with files and folders this, use cdDoc*ts instead. location, but you
You can now list directories and navigate your file system, Two characters that are more useful when navigating are have to manually
but what about doing something practical, like moving and the single quotation mark (‘) and backslash (\) characters. add this option to
Ubuntu's Nautilus
copying files? You'll find a range of different commands exist, Use single quotation marks around files or file paths that
file manager.
and the tricks you’ve learned about navigation will hold you in contain spaces, such as cd ~\Documents\Doctor Who . Install nautilus
good stead here too. You should also use quotation marks when creating open-terminal
Let’s start by looking at commands for copying (cp) and foldersinthis way, eg simply typing mkdir Doctor Who will from the Software
Center, then open
moving ( mv) files and folders. The same options apply to actually create two separate folders called Doctor and Who.
a Terminal window,
both commands. The basic syntax is cp/mv <source> so type mkdir‘Doctor Who’ to get the folder you want. type nautilus -q
<target>. The source and target can be complete paths You can also use the \ charactertogetaroundthistoo.eg and press Enter.
following the same rules for the cd command, but it's mkdir Doctor) Who works in the same way. because the \ The option will
generally good practice to first navigate to the folder character instructs mkdir to treat the following character (in now appear.
containing the file or folder you wish to copy or move. Once this instance the space) as 'special'.
done, you can simply specify the file or folder name as the We finish off by revealing some handy characters that
source, like so cp invoice.odt -/Documents/Backup . allow you to run multiple commands on a single line. The &&
This creates a copy of the file with the same name. argument does just that, so you can do the following to
The following copies the file to the specified directory and quickly update your repos and update all available software:
renames it too: cp invoice.odt ~/Documents/Backup/invoice- sudo apt-get update && sudo apt-get upgrade
backup.odt. If you want to create a copy of the file within the && is like the AND command in that the second
same file, simply use cp invoice.odt invoice-backup.odt. command will only be performed if the first completes
Substitute mv for cp in any of the above commands, successfully. If you wanted the second command to only run
and the file is moved, moved and renamed or simply if the first command failed then you'd use II instead. If you
renamed. What happens if there's already a file called want the second command to run after the first regardless of
invoice-backup.odt in existence? It'll be overwritten without what happens, then use the ; eg.
as much as a by your leave, so make sure you're asked if you sudo apt-get update; sudo apt-get remove appname
want to overwrite it by adding the -i flag like this mv-i instead: of && . ■
invoice.odt invoice-backup.odt.
You can also copy folders using the cp or mv media VtrtualBox VMs
Music wget-log
commands. Here, you need to include the recursive option, ntck@nick-ubuntu:~$ is -h -I
total 2.5M
which ensures the folder is copied across with all its contents drwxrwxr-x 2 nick nick 4.OK Feb 15 15:08 deja-dup
and correctly arranged in their original locations relative to drwxr-xr-x 2 nick nick 4.OK Feb 28 17:21 Desktop
drwxrwxr-x 2 nick nick 4.OK Feb 26 17:35 Doctor
the parent folder: cp -r -/Documents /mnt/sdbl/Backup/. drwxr-xr-x 3 nick nick 4.OK Feb 26 17:44 Documents
drwxr-xr-x 4 nick nick 4.OK Feb 27 13:23 Downloads
If the Backup folder exists, then the Documents folder -rw-r--r-- 1 nick nick 8.8K Nov 26 12:51 examples.desktop
drwxr-xr-x 2 root root 4.OK Feb 4 19:49 fedora
will be recreated inside it; if not, then the Backup folder is
-rw-rw-r-- 1 nick nick 446K Jan 20 12:35 linuxdesktops-enlightenment.png
created and the contents of the Documents folder are copied drwxr-xr-x 3 root root 4.OK Feb 4 19:50 media
drwxr-xr-x 2 nick nick 4.OK Nov 26 13:10 Music
into it instead. drwx............ 2 nick nick 4.OK Feb 10 16:43 NoMachine
dfwxr-xr-X 2 nick hick 4.OK Nov 26 13:10 Pictures
Use the rm command to delete a single file, eg rm
Irwxrwxrwx 1 nick nick 36 Dec 10 13:35 PlayOnLinux's virtual drives -> /home/n
invoice.odt. The rmdir command deletes folders, but only ick/.PlayOnLinux//wincprefix/
drwxr-xr-x 2 nick nick 4.OK Nov 26 13:IO Public
empty ones. If you want to delete a folder and all its contents, -rw-rw-r-- 1 nick nick 871K Jan 13 10:22 steamosl.png
drwxr-xr-x 2 nick nick 4.OK Nov 26 13:10 Templates
use the command rm -r foldername . -rw-rw-r-- 1 nick nick 1.1M Dec 24 22:09 tigervncserver_1.6.0-3ubuntul_amd64.deb
You can also create new folders with mkdir command - drwxr-xr-x 2 nick nick 4.OK Nov 26 13:10 Videos
drwxrwxr-x 6 nick nick 4.0K Nov 30 09:43 VtrtualBox VMs
simply type mkdir folder, replacing folder with your chosen -rw-rw-r-- 1 nick nick 3.5K Jan 21 11:39 wget-log
[nick^nick-ubuntu:|__________________________________________________________________
folder name. Use the touch command to create an empty
file, such as touch config.sys . > Use Is to find out more about the files and folders in a current directory.
Terminal:
Edit config files
We demonstrate how the Terminal is the best place to edit your Linux
installation's configuration files and take some control.
he Terminal is one of Linux’s most important tools, editing them is relatively simple and all you need is a suitable
next to those commands you want to enable, tweak them « Uncorvtent to enable BadRAM filtering, modify to suit your needs
• This works with Linux (no patch required) and with any kernel that dbtaihS
» the memory nap information from GRUB (GNU Mach, kernel of FreeBSD ...)
accordingly, save the file and then restart the PHP server to •GRU8_BA0RAM.*exB12J4S67,9xfefefefe,Bx89*b<d*f,exefef*f*f*
You'll see a largely blank document with a single line need to add the following line immediately below it: GRUB_
matching the name of your computer from your netwo-k. SAVEDEFAULT=”true”.
You need to change this to something else. Remember the Other lines that are worth examining include GRUB_
rules for hostnames: they need to be a maximum of 64 HIDDEN_TIMEOUT . If you only have a single operating
characters, with letters, numbers or dashes only (so no system installed, this should be set to GRUB_HIDDEN_
spaces or underscores, eg). TIMEOUT=”0”. indicating the Grub menu remains hidden
Once done, press Ctrl+X, typing y and hitting Enter when and boots to the default OS after 0 seconds. And if Grub is set
prompted. If you now type hostname and hit Enter, you'll see to appear, you can alter the length that the Grub menu is
your hostname has been updated to the contents of the file. visible before the default OS is selected via the GRUB_
However, if you leave things as they are, you'll start getting TIME0UT= setting, which measures the delay in seconds
'unable to resolve host’ errors and you will need to use sudo (which is 10 by default).
nano /etc/hosts and update the reference next to 127.0.0.1 to When you have completed all your tweaking, remember to
point to your hostname too. save the file and exit nano, then type sudo update-grub and
This is a basic edit of a configuration file, so let’s try hit Enter, so when you reboot your changes can be seen in
something a little more daring: the boot menu. ■
Terminal:
Get system info
We discover how to get useful information about the Linux system
and its hardware with the help of the Terminal.
egardless of what desktop you use. beneath it all lies the universal Ishw command, which provides every scrap of
display the drive's label and its UUID. The UUID is often used •kkQnkk-pc - '*<■<* 09-M O
nickQnick-pc:~$ Upcl -v
when configuring drives to automatically mount at startup via 00:66.6 Host bridge; Intel Corporation 4th Gen Core Prozessor DRAM Controller (rev 06)
Subsystem: ASRock Incorporation Device 0c00
the /etc/fstab file. You can also gain insights into each drive's Flags: bus master, fast devsel, latency 6
Capabilities: <access denied>
owner, group and permissions (listed under 'mode') using the Kernel driver in use: hsw_uncore
96:01.6 PCI bridge: Intel Corporation Xeon E3-1266 v3/4th Gen Core Processor PCI Express x!6 Controller (rev 66) (prog-
-m flag. These work in a similar way to the Is command if 66 [Normal decode])
Flags: bus master, fast devsel, latency 6, IRQ 25
(see Linux Format 210). but reveal insights at the top level. Bus: prinary-09, secondary-01, subordinate-61, sec •latency©
I/O behind bridge: 00000006 6666efff
You can also sort the drive list by different columns using the Memory behind bridge: e90G0006 f30fffff
Capabilities: <access denied*
-x switch - eg to list drives in size order (smallest drive first), Kernel driver in use: pcleport
type: Isblk -x size . 66:14.6 USB controller: Intel Corporation 8 Series/C226 Series Chipset Family USB xHCI (rev 04) (prog-if 36 [XHCI])
Subsystem: ASRock Incorporation Device 8c31
Flags: bus master, medium devsel, latency 6, IRQ 26
Memory at H120600 (64 bit, non profetchablo) [;i2O=64K]
Working with Fdisk Capabilities: ^access denied*
Kernel driver in use: xhci.hcd
The fdisk command is traditionally used to change partition 06:16.0 Communication controller: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller «1 (rev 04)
tables, but pair it with the -1 switch and it can also display Subsystem; ASRock Incorporation
Flags: bus master, fast devsel,
Device 8c3a
latency 0, IRQ 29
Memory at f313c000 (64 bit, non prefetchable) [size=16]
more detailed information about a particular drive. Use it in Capabilities: <access denied*
Kernel driver in use: mei.me
conjunction with a drive's identifier (/dev/sda for an entire
>0*10 ft FthArnAt rnntrnllpr- Tntol (~nrrv\r.ir i nn rthgrriAt CnnnprtiAn T217-V frev 04^
disk, /dev/sdal for a partition), eg sudo fdisk -1 /dev/sda .
This will list the device identifier, its start and end points on > Use the -v flag with the Ispci command to generate a more useful view of your
the disk (or partition), the number of sectors it has and its system's internal hardware—including driver information.
size, plus - a crucial bit of information - the partition type.
This is quite descriptive, helping you identify which partitions Make a note of its bus number and device number, then
are which (and particularly useful when examining a dual type the following command sudo Isusb -D /dev/bus/
boot setup involving Windows partitions). usb/OOx/OOy . Replace OOx with your target device’s bus
Partitions are listed in the order they were created, number, and OOy with its device number. This will limit the Want a friendlier
not their physical position on the drive—look for the 'partition output to the selected device only. way to view USB
devices? Type sudo
table entries are not in disk order' message if this is the case. One final tool that's worth considering for learning more
apt-get install
Examine the Start and End columns carefully to work out about your hardware is the dmidecode utility, which takes the usbview to install
where each partition physically resides on the disk. information listed in your PC’s BIOS and presents it in a more the USB Viewer
Two further commands - Ispci and Isusb respectively - user-friendly format. What's particularly useful about this tool too/.Notethatwhile
provide you with detailed information about other hareware is that it can glean information from your PC’s motherboard, it runs in a GUI, you
need to invoke it
devices. The Ispci command focusses on internal hardware, such as the maximum amount of supported memory or the
from the Terminal
while Isusb looks at peripherals connected to (wait for it) fastest processor it can handle. It’s best used in conjunction using the sudo
your PC’s USB ports. with the -t switch, which allows you to focus the dmidecode usbviewcommand.
Both work in a similar way - the command on its own lists tool on a specific part of your system’s hardware, eg sudo
each connected device - which bus it's on, its device number dmidecode -t bios.
and ID. plus some descriptive information (typically The BIOS option reveals key information about your
manufacturer and model) to help identify which is which. motherboard, including what capabilities it supports
Add the -v switch for a more detailed view and don't forget (including UEFI, USB legacy and ACPI) plus the current BIOS
to invoke them using sudo to ensure you have full access to version, including its release date. Other supported keywords
all connected hardware. include ‘baseboard’ for identifying your motherboard make,
O; the two, Ispci produces less information in verbose model and serial number, ‘processor’ (check the Upgrade
mode— sudo Ispci -v will list each device by type and name, field to see what kind of socket it’s plugged into), 'memory'
then list some extra details including the device's various and 'chassis'.
capabilities and - rather usefully - which kernel driver it’s Note that the DMI tables that contain this BIOS-related
using. Type Isusb -v. however, and you'll be assailed by pages information aren’t always accurate, so while dmidecode is a
and pages of detailed information about each detected potentially useful resource, don't be shocked if certain things
device. Navigating this by hand is excruciating, so start by don’t stack up (it incorrectly reported only half of our RAM.
identifying the USB device you want to check in more detail eg). Treat it with due care and it adds another layer to your
using sudo Isusb. system information armoury. ■
Terminal: Set
up partitions
It's time to reveal everything you need to know about setting up a hard disk
from partitioning, formatting and setting permissions.
core hard drive skill is partitioning. You'll have however, then you’ll need parted instead (see the box Resize
Resize partitions
If you want to create a partition without data parted /dev/sdb partition number, and 4500 with the new end
loss, you will need to use the parted utility— First, enter 'print' for an overview of the drive's point. It can be quite a complicated manoeuvre:
this is the command-line equivalent of the current structure—you'll need to make a note of you may need to shrink one partition before
Gpartedtool and offers similar functionality to the start and end points of each partition. growing the other in its place (if you go down
fdisk with one crucial addition: the ability to Then use the resizepart command to shrink or this route, when you grow the second partition
resize existing partitions. In a similar way to grow a partition: you'll need to specify its start and end points, eg
fdisk. you launch the utility by selecting your resizepart 1 4500 resizepart 2 450 4500 . If it all starts to get too
target device like so: And remembering to replace 1 with the target complicated, use Gparted instead.
This will have fdiskswitch to command mode. Type m Replace <fs-type> with the relevant filesystem (ext3
and hit Enter to see a list of all supported commands. orfat32,eg) and <device> with your device (such as
Let’s start by checking the existing partition table for the /dev/sdbl). Depending on the size of the partition this can
drive: type p and hit Enter. This displays the same output as take a while to complete—a couple of hours in extreme cases.
the fdisk-1 command. If the disk isn't currently empty, you'll Once done, you’ll need to mount the drive to a specific folder:
see a list of existing partitions appear. From here you have two sudo mount <device> <mountpoint>
options: wipe the disk completely and start from scratch or In most cases, you'll want to set <mountpoint> to /
remove individual partitions and replace them. media/<usemame>/<folder> , replacing <username> with
Before going any further, remember the fail-safe: until you your username, and creating a folder there for the partition to
exit with the w command, no changes are made. So if you reside in, eg: sudo mount /dev/sdbl /media/nick/3TBdrive .
make a mistake and want to start again, use q instead, then
start from scratch.To mark an existing partition for deletion— Fix drive permissions
thereby wiping all its data, but leaving the rest of the disk If you format the drive using the default ‘Linux filesystem'
intact-type d and hit Enter. You'll be prompted to enter the option then as things stand you have no write permissions on
partition number, which you can identify from the device list the drive—to fix this for an external drive, type the following:
(eg, ‘1’ refers to sdbl and ‘2’ to sdb2 etc). Press the number sudo chown -R <username> <mountpoint> We have told a
and the partition is marked for deletion, which you can verify If you'd like to widen access to the drive without giving up lie, you can get
by typing p again —it should no longer be listed. ownership, try the following three commands: dd to display its
progress since
Alternatively, wipe the entire disk - including all existing sudo chgrp plugdev <mountpoint>
v8.24 by adding
partitions on it - and start from scratch. To do this, you need sudo chmod g+w <mountpoint> && sudo chmod +t the option of
to create a new partition table (or label). There are four <mountpoint> status=progress
options, but for most people you'll either want a DOS/MBR This will allow members of the plugdev group to create which is nice.
partition table (type o) or GPT (type g) one. files and sub-directories on the disk—the +t flag ensures
Once the disk is empty or you've removed specific they can only delete their own files and sub-folders.
partitions, the next step is to create a new partition (or more). Finally, note that drives aren't automatically mounted at
Type n and hit Enter. You’ll be prompted to select a partition each startup - you'll need to manually add them to the /etc/
number up to 4 (MBR) or 128 (GPT) and in most cases, just fstab file (see Linux Format 111 for editing configuration file
pick the next available number. You'll then be asked to select advice) - here's the line you should add for ext3 file systems:
the first sector from the available range—if in doubt, leave the <UUID> <mountpoint> ext3 defaults 0 2
default selected. Finally, you'll be prompted to set the drive’s You will need to replace <UUID> wth the partition's Disk
size, either by setting its last sector, choosing the number of Identifier, which you can get by using the sudo bikid <device>
sectors to add or - the easiest choice - by entering a physical command. You want to use this identifier instead of the
size for the partition, typically in G (gigabytes) or T device itself, because it's the only consistent way of
(terabytes). To create a partition 100GB in size, type +100G identifying the partition. Once saved, test that this works with
and hit Enter. At this point, fdisk will tell you it's created a new the sudo mount -a command—if there are no errors,
partition of type 'Linux filesystem'. If you'd rather the partition congratulations: your hard disk has been partitioned and set
used a different file system, type t followed by the partition up correctly! ■
number. You'll be prompted to enter a Hex code—pressing 1
lists a large range of alternatives, and the simplest thing from :k$ntck sudo unount /dev/sdei AA sudo nount /dev/sdel /ned(a/nlck/3T6drlve
here is to select the hex code you want with the mouse, right <k(?nick-pc:~$ cd /nedU/nlck
click and choose 'Copy' and right-click at the fdisk prompt ck^nick-pc : /fM»dte/ntck$ sudo chown -R nick /nedia/nick/JTBdr ive
ck£ntck’pc:/rM*dU/nt(k$ sudo chgrp plugdev /nedta/ntck/3T8drlve
and choose ‘Paste’. If you want to create a FAT, exFAT/NTFS or ck£nick-pc:/nedia/ntck$ sudo chnod g»w /nedia/nick/lTBdrtve
ck?nlck-pc;/nedU/ntck$ sudo chnod tt /nedU/ntck/3T8drive
ck£ntck>pc:/nedia/ntck$ Q > You must set
FAT32 file system, eg, paste the 'Basic Microsoft data’ code.
up appropriate
Happy with the way you've set up your partitions? Type p
permissions
one more time and verify everything's the way you want to
on the new
set it. then press w and hit Enter to write your changes to partition after
the disk. Although the disk has been partitioned, you now formatting
need to format it. This is done using the mkfs command: Security context: unknown it in order to
sudo mkfs -t <fs-type> <device> access it.
Terminal:
Remote access
Uncover how to run another computer's Windows X applications through
your own desktop with SSH aka secure shell access.
ne of the great things about the Terminal is that it need to install OpenSSH Server on your server or target PC:
Start by generating the required public and insecure connections on the host PC by editing
private SSH keys on your client: the sshd.config file to replace the line
$ ssh-keygen -t rsa -b 4096 #PasswordAuthentication yes with:
Hit Enter to accept the default location for the PasswordAuthentication no I —|
♦ - [SHAZS6]....... ♦
file. When prompted, a passphrase gives you Once done, you’ll no longer be prompted nick$t)buntuVM:-$ ssh-copy-id nick0192.168.3S.82
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s),
already installed
greater security, but you can skip this by simply for your user password when logging in. If you /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you
nstall the new keys
hitting Enter. Once created, you need to transfer subsequently need access from another trusted nick0192.168.35.82's password:
this keyto your host: computer, copy the key file (~/.ssh/id_rsa)
$ ssh-copy-id usemame@hostname from your client to the same location on that > Generate SSH public and private keys to
(Note, if you've changed the port number for computer using a USB stick. ensure a more secure connection.
Terminal:
Display settings
It's time to go beyond the confines of Screen Display settings to take full
control of your display resolution settings with xrandr.
randr is your best friend if you’re looking for a way to (eg, 1920x1080+1920+0 indicates the display in question is
1280x1024 60.02
Next, you'll see that each supported display input is listed 1440x900
1286x960
as disconnected or connected. Whichever input is connected 1280x720
1624x768
60.00'
75.88 70.07
59.94
66.66
832x624 74.55
will correspond to the display in quesdon, either LVDS for a 800x606 60.32
720x576 50.00
720x480 60.00 59.94
laptop's internal display, or DVI. HDMI or VGA for external 640x480
720x400 70.08
monitor connections. Next to this is the current resolution,
plus - if two or more display monitors are currently > One of the main uses for xrandr is to open up Ubuntu to
connected - their positions in relation to each other use all your display’s supported resolutions.
The main use for xrandr is to change the display resolution > Panning allows
of your monitor, which is done with the following command: four two displays to mirror the contents of each other? Use
you to display
$ xrandr -output HDMI-0 -mode 1680x1050 I larger resolutions
0 -same-as HDMI-0 p on smaller
Substitute HDMI-0 for the connected display, and
jher resolution than the other, the display with the lower displays without
1680x1050 for the desired mode from those supported. the bits it can't show - by using the -panning flag you
nove with the mouse to ensure it's always on-screen - making them
You can also set the frame rate by adding -rate 60 to the the resolution of your main display:
too cramped
end. but as we’ve said, this isn't normally necessary. •0 ••panning 1920x1080
If you’ve got only one display attached, you can replace h care - the only way we've found to disable mirroring and
both -output and -mode flags with a single -s flag, which I nlckQnlck-pe: ~
tricks up xraj|ntck®ntck-pc:~$ xrandr - output VGA-1 - panning 1920x1080
tells xrandr to set the resolution for the default display to the ts capability>ntckgntck-pc:~$ |
limitation of
specified size $ xrandr -s 1680x1050 . on't survive r
Admin: Core
commands
20 terminal commands that all Linux web server admins should know.
re you an ‘accidental admin’? Someone who realised, straightforward to do through the graphical control panel,
OOP .«<•«.«» (Ml: - the adaptor, but it’s also useful to see if you’re connected to a
studiope(Jstudidpe:~$ ssh rootfki.'W. •
Welcome to Ubuntu 16.64.1 LTS (GNU/Linux 3.16.6 x86_64)
VPN or not. If a connection is described as ethO, for example,
* Documentation; https://hclp.ubuntu.con
it’s an Ethernet cable meanwhile tunO is a VPN tunnel.
♦ Management: https://landscdpe.canontcal.com
• Support: https://ubuntu.com/advantage If you're changing
EJ chown names, permissions
There’s tons more you can learn about chmod and we or ownership most
strongly recommend that you do, but it has a sister command commands have
a-R or-r option,
that’s even more powerful. While chmod dictates what users
which stands
who aren't the owner of a file can do, the chown command for'recursive'.
changes the file owner and group that it belongs to Essentially, this
completely. Again, you'll probably need to put sudo in front changes the
of anything you chown . but the syntax is again simple. An attributes of all
> Even if someone copies your key, they’ll still need a files inside a folder,
example might be chown myname:mygroup filename.file .
password to unlock it. rather than just the
folder itself.
D service restart
what you’re doing). After entering sudo. you’ll be asked for No, we’re not telling you to 'try turning it off and on again',
your user password. On a desktop PC. this is the same one but sometimes it’s a good place to start (and sometimes its
that you use to log in. If you're logging into your own essential to load changes into memory). It’s possible you
webserver, however, there's a good chance that you'll already might be used to start and stop background processes on a
be the root user and won't need a password to make Windows desktop through the graphical System Monitor or
important changes. Task Manager in Windows. However, in the command line
If you can't execute sudo commands, your web host has Terminal to a server it’s a little more tricky, but not by much.
restricted your level of access and it probably can’t be Confusingly, because many Linux distributions have
changed. User accounts can be part of 'groups' in Linux and changed the way they manage startup services (by
only members of the sudoers groups can use the sudo switching to systemd) there's two ways of doing this. The
command to temporarily grant themselves admin privileges. old way. which still works a lot of the time, is to just type
service myservice restart . preceded with sudo .when it’s
Dsu necessary. The new, correct, way is a little more verbose:
While sudo gives you great power, it still has limitations. Most systemctl restart myservice.service . So if you want to restart
of all. if you've got a whole bunch of commands to enter, you Apache, for example, the core software which turns a mere
don't want to have to type it out at the start of every single computer into a web server, it would be sudo systemctl
line [at least the password has a 5 minute timeout-Ed]. This restart apache2.service.
is where su comes in, which will give you superuser powers
until you close the terminal window. Type sudosu followed
by your password, and you'll see the prompt change from Baby•Triceratops.stl
background.jpg
yourname@yourserver to root@yourserver .You might think BACKGROUND.kra
BankTransactions.csv
su stands for superuser, but It’s actually a command to Bosc_x2.stl
batteryholders.geode
change to any user on the system and if it’s used without an BigDataarttele.doex.docx
btg•gear -nodSAE.stl
account name after it, su assumes you want to be root. btg_ptxel_star.stl
Blackboard
However, using sumyname will switch you back to your Black Rhino Mozambique Gas Giant v2.docx
blank share certtftcatc.pdf
BOM.ods
original, non-super, login. bootngr.cfi
B&P_PuzzleChatr.zip > Unless you
Branch_vase_lc(l).STL
EJ ifconfig Branch_vase_lc.STL
Branch_vase_l.STL
can read 1,000
Branch_vase_2.STL lines a second,
Since you’re troubleshooting a web server, it's probably a brave_elz ing-alii s.stl
c406_firnwarc_update_tnstructtons_660F.pdf you’ll need to
good idea to get as many details about its actual connection c4e6_rev070H_bootable_nedta_tnstructtons.zip
c466 rev676H_ftrnware_update_uttltty.zip use Is I less to
as possible noted down. The ifconfig command can be run cablc_cltps.stl
Calculatton_Ttana_FIHAL AO.xlsx
explore folders.
without sudo privileges and tells you details about every live calibrateddell .ice
calibrated.ten
network connection, physical or virtual. Often this is just for cape•town•344257_1286.Jpg
Cape Town, Houscsof Parliament.JPG
checking your IP address, which it reports under the name of
Bls EJdf
The key to understanding the console is all in the path (see Maybe your server problems are to do with disk space? Type
Path To box, below), which tells you whereabouts you are in df and you'll get a full breakdown of the size and usage of
the folder structure at any given time. But how do you know every volume currently mounted on your system. By default
what else is in your current location? Easy: you use Is. The it'll give you big numbers in bytes, but if you run df-h (which
Is command lists all the files within the folder that you're stands for 'human readable' the volume sizes will be reported
currently browsing. If there's a lot of files to list, use Is I less in megabytes, gigabytes or whatever is appropriate.
to pause at the end of each page of filenames.
ED apt-get update && upgrade
Beat Probably the single most important command to know and
A command you'll often see if you're following instructions fear. We all know that to keep a computer system secure you
you've found online - and aren't always sure what you're need to keep it updated, but if you've got control of a Linux
doing - cat is short for concatenate and is used to combine box the chances are that it isn't doing that automatically.
files together. In its simplest form it can be used to take file! A simple sudo apt-get update will order your system to
txt and file2.txt and turn them into file3.txt, but it can also be check for the latest versions of any applications it's running,
combined with other commands to create a new file based on and sudo apt-get upgrade will download and install them.
searching for patterns or words in the original. For the most part these are safe commands to use and
Quite often you'll see cat used simply to explore a single should be run regularly—but occasionally updating one piece
file-if you don't specify an output filename, cat just writes of software can break another, so back-up first...
what it finds to the screen. So online walkthroughs often use
cat as a way of searching for text within a file and displaying ED grep
the results in the terminal. This is because cat is non As computer commands go there are few more fantastically
destructive—it’s very hard to accidentally use cat to change named for the newcomer than the grep [it’s a real verb!-Ed]
the original file where other commands might do. command. How on earth are you ever going to master this
Linux stuff if it just makes words up? But grep is a great
□ find utility for looking for patterns within files. Want to find every
A useful and under used command, the find command is line that talks about Cheddar in a book about cheeses? grep
pretty self-explanatory. It can be used to find stuff. Typing it by "cheddar" bookofcheese.txt will do it for you. Even better you
itself is much like Is, except that it lists all of the files within can use it to search within multiple files using wildcards. So
sub-directories of your current location as well as those in grep “cheddar” *.txt will find every text file in which cheddar
> Nano isn’t the your current directory. You can use it to search for filenames is reference. So now you grok grep , right?
only terminal
using the format find -name “filename.txt”. By inserting a
text editor, but
path before the -name option, you can point it at specific ED top
it’s the easiest
starting folders to speed things up. By changing the When you're working in a graphical user interface such as a
to use.
-name option you can search by days since last accessed Linux desktop environment or Windows desktop, there's
(-atime ) or more. always an application like System Monitor or Task Manager
which will call up a list of running applications and give you
details about how many CPU cycles, memory or storage
Mji9e S7e.eeeeee they're using. It s a vital troubleshooting tool if you have a
H109 S190.000000
jSltced at: Sat 19-11-2616 15:11:69 program that's misbehaving and you don't know what it is.
;Baslc settings: Layer height: 6.1 Walls: 6.7 Fill: 26
;Prtnt tine: 5 hours 39 ntnutes In a similar way, you can bring up a table of running
jFilancnt used: 16.646n 29.6g
;Filanent cost: None applications in the Linux Terminal that does the same thing
;M196 S76 ;Unconnent to add your own bed tenperature line
;H169 S186 ;Unconnent to add your own tenperature line by typing top.
G21 ;nctrtc values
G96 ;absolute positioning Like a lot of command line utilities, it's not immediately
M82 ;set extruder to absolute node
H167 ;start with the fan off obvious how you can close top once you're finished with it
C28 >6 Y6 ;nove X/Y to nin endstops
G28 20 ;nove Z to nin endstops without closing the terminal window itself—the almost
Cl Z15.6 F7866 ;nove the platforn down 15nn
C92 EG ;zero the extruded length universal command to get back to a prompt is Ctrl+c.
Cl F266 E3 jextrude 3nn of feed stock
C92 EO ;zero the extruded length again
G1 F7866
;Put printing nessage on LCD screen
ED kill, killall
H117 Printing...
Using top you can figure out which application is using all
;Layer count: 198
;LAYER:6
your CPU cycles, but how do you stop it without a right-click >
g Cet Help JJ Write Out 2J Where Is ffl Cut Text Justify Q Cur Pos Q Prev Pape End process menu? You use the command kill followed by
Exit E Pead File 3 Replace E Uncut Text S To Spell 3 Co To line 3 Hext Pape the process name. If you want to be sure and kill every
Path to
When you open a Terminal window within Linux, machine you're logged into. If you open up a followed by a dollar sign. When you first open a
it can be a bit disorientating. But the words that Terminal on your desktop, usually the username Terminal, it will usually print yourname@
sit in front of the flashing cursor will tell you and hostname are the same. So you'll see ycurname:~$. The tildeindicates you're in the
where you are. 'myname@myname'. When you log into a home folder for your username. If the dollar sign
The first word is the name of the user you’re remote server, though, they'll be very different. is replaced with a '#', you're using the machine
logged in on. and it's followed by an sign. This information is followed by a colon which as a root user. See cd for moving around and
The second word is the hostname of the is followed by the path to the directory you're in. watch how the path changes as you do.
20. chmod
User permissions are one of the most important Wordpress to be able to write some files so it can by three digits to indicate what the owner,
parts of L nux security to understand. Every file update them, but there's also a lot of files you members of its group and everyone else can do.
has a set of permissions which defines who can don't want it to be able to change—and you really Each digit from 0-7. where 7 allows for read, write
see a file: who can read and write to a file: and don’t want to give it power to execute code and execute and 1 is execute only. If your user
who can execute a file as a program. unless you have to. The flipside is that problems ’owns’ the file in question, the syntax is simple,
A file which can be seen by web visitors, but with web servers can be traced back to incorrect chmod 777 filename . for example, will give all
can only be changed by a specific user, is just file permissions, when an app needs to be able to users the ability to read and write to a file. It’s
about as basic as it gets when it comes to locking modify a file but has been locked out by default. good practice not to leave files in this state on a
down a server. The problem is that some files Your friend in this area is chmod. It changes webserver—for obvious reasons. If you don’t own
need to be changeable and some don’t—think of permissions for which users and groups can the file, you’ll need to add sudo to the front of
a Wordpress installation for a blog. You want read, write or execute files. It’s usually followed that command.
process with a name that contains that application name, you >pc()studiopc:/etc$ cd /ctc/Xll/Xsession.d
bpc0studtopc:/etc/Xll/Xscsston.d$ Is
use killall. So kill firefox will close down a web browser on :art 66x11-connon_localhost 98atk-adaptor
►_xdg-runttne 66x11 - coRRon_xdg_path 96consolektt
a Linux desktop. connon_process-args 60xbrlapl 90gpg-agent
■coRRon_xresources 60xdg-user-dirs-update 96qt5-opengl
connonxhost-local 65coRpiz_proftie - on■session 96qt-ally
EDw connon xsessionrc
?ck_untty_support
65snappy
76gconfd_path-on-session
96x11-connonssh-agent
95dbu s_updatc-activation-env
From the weirdness of grep to the elegance of the w coHHon_deternine- startup 70in- config_launch 99upstart
»anon-session_gnonerc 75dbusdbus-launch 99x11-connon_start
command, a whole command in a single letter. If you think ie-session_gnonerc Sloverlay-scrollbar
>pc0studlopc:/etc/Xll/Xsesston.d$ cd ..
another user is logged into your system, this is an important ►pc^studiopc:/etc/Xll$ cd ..
>pc0studiopc:/etc$ cd ..
command to know. You can use w to list all currently active ipc^studlopc:/$ Is
dev Include lib nedla proc sbtn swap ublqulty-apt-clone vnllnuz
users, although don’t rely on it too much as it’s not hard for a etc tnitrd.iRg ltb32 ltbx32 Rnt root snap sys usr vRltnuz.olq
hacker to be hidden. hoRe Inltrd.iRQ.old Ub64 lost+found opt run srv var
>pc0studtope:/$ Q
ED passwd
You must use passwd with extreme care. Ultra extreme care.
Because the next word you write after it will become your > Keep an eye on the directory path in front of the
command line to figure out where you are.
login password, so if you type it incorrectly or forget it. you’re
going to find yourself in serious trouble.
You can only change your own user's password by default, rm is used to remove or delete a file and cp will copy files
but if you grant yourself sudo powers you can change any and folders.
user's credentials by including their username after the Just as with cd , you can either enter a filename to
password itself. Typing sudo passwd . meanwhile, will change operate on a file in the directory you’re working in or a full
the password for root. path starting from the root of the drive with ~ . For mv the
Check out the manual (man passwd) page for some syntax is mv ~/locationl/filel.file ~/location2/location .
useful options to expire passwords after a certain period of The big thing to remember is that in the Terminal there’s
time and so on. no undo or undelete function: if you rm a file and it's gone
forever (or at least will require very specialist skills to retrieve)
ED cd and in a similar fashion, if you mv or cp a file you'd better
If you have a graphical interface and file browser, it's pretty make a note of where it went. One command
that’s invaluable
easy to move to new locations on your hard drive just by
is man which is
clicking on them. In the Terminal, we know where we are ED nano short for'manual'.
because of the path (see the Path To box. left). and switch It might seem odd, if you've spent your life in graphical This will open up
location using cd which stands for‘change directory'. applications and utilities, but complex programs run in the the help file for any
The cd command in mainly used in three ways: text terminal, too. There are several text editors which other command.
So if you want
0 cd foldername This will move you to that folder, provided normally come as part of the whole package, notably nano
to know all the
it exists within the folder you're currently browsing (use Is if and vi. You can open a blank document by typing nano , or options for the Is
you’re not sure). you can edit an existing one by typing nano ~path/to/text,txt command, simply
0 cd ~/path/to/folder This will take you to a specific (and do the same with vi). Some of the terminology may type man Is and
location within your home folder (the ~ character tells cd see what comes up.
seem odd. though: To write out (Ctrl+o) means save, for
to start looking in your home folder). Starting with a / will tell example and so on.
cd to start the path at the root folder of your hard drive.
0 cd.. This final useful command simply takes you up one ED history
level in the folder structure. And finally, if you've been copying and pasting commands
from the web all day. you might want to check up on what
ED mv & rm & cp you've actually done. You can use history to give you a list of
When you get the hang of it. using a terminal as a file all the terminal commands entered going back a long, long
manager becomes pretty simple and quite a joyful way. Execute specific numbered commands with !<num>,
experience. As well as cd. the three fundamental commands you can go back through recent commands just by using the
you’ll need to remember are mv, rm and cp . The mv up and down arrows (and re-issue them by tapping Enter), or
command is used to move a file from one location to another, search for commands by pressing Ctrl+r.
_ WORLDS
&CANI TOMORROW
Explore our
incredible planet
and the secrets
beneath the
OUR SEAS
v surface /
I HUMANS
Annual
Understand the
world we live
in, from science MNOLOGY ^TRANSPORT QhISTORY OSPACE
Get great savings when 1000s of great titles, many World-wide delivery and
you buy direct from us not available anywhere else super-safe ordering
FEED YOUR MIND
WITH OUR BOOKAZINES
Explore the secrets of the universe, from the days of the
dinosaurs to the miracles of modern science!
inc —
Life’s «
Science
COLLECTION
Little
Mysteries
13} the truth _
Mundchr
O1“ of Kiencr and ttrh . SUPERMASSIVE
!■! AASB
UNDERSTANDING
<iia n
i the Ws =
Discover
HUMAN" answers to
'SUCCESS
the most
fascinating futurebookazines
questions
el www.magazinesdirect.com
r Magazines, back issues & bookazines.
SUBSCRIBE &
SAVE UP TO 61%
Delivered direct to your door
or straight to your device
12 nuill-Jriv comfortfood recipes
worn
Hello . yicroajA
DSR3YSMIAS
<ni Knm ii-iip
iMii.iiH-t-O*kn ing
ink'
.
KING
(<» IllMljO lent Iranian emperor
, . trixue to do mkuttJt
t^land
miM<riilst)fc liervshtm APES
utumn scenes and
ITGIIADEYOI II otour and light ' J - *<
HATH ROOM '
MS
4G
PHOTOWS
tASY
birds an<istarr- hMCOHTMc
ft TO 200™ CAREER
Sing'nS tWngs't' Rte ate KEITH r/2.8GMQ$S«
SUCCESS
Thebest
RICHARDS fl mi III ii Bolster your txinl- I
account today I
NIGKELBAGK
KISS 2DCCE22
CVKEEE5
X06UKMCn
BUSH
"®F( +
Choose from over 8o magazines and make great savings off the store price!
Binders, books and back issues also available
Simply visit www.magazinesdirect.com
No hidden costs Shipping included in all prices We deliver to over 100 countries Q Secure online payment
FUTURE
magazines direct.com
Official Magazine Subscription Store
HACKER’S
MANUAL 2023
148 PACKED PAGES! WITH HACKS THE
OTHER LINUX MANUALS WON’T TELL YOU
Hacker’s Toolkit
H
Discover the basics of hacking with our Get the lowdown on the best distros,
in-depth and easy-to-follow tutorials including the latest Ubuntu LTS release
REVISED £
UPDATED
B O O K A Z IN E
EDITION