The very introduction to Raspberry Pi

After a nearly five years of struggling with hardware and software for feeding data to Flightradar24, I have finally decided to give it a try with Raspberry Pi. On contrary to what some of you may think, this is not a guide on how to achieve it. The original text is very good and quite self-explanatory. No need to copy it here.

In addition to feeding data to Flightradar 24 there are hundreds of ideas how can you use your Raspberry Pi. With this article I wanted to show you (and remind to myself) just of a few IMHO most interesting ones.

If you’re just unpacking your first Raspberry Pi then better read these two articles:

before even continuing with this article.

Read More “The very introduction to Raspberry Pi”

Add one or more folders to .zip archive

To add single directory (with all files and sub-directories) simply execute:

zip -r name_of_your_directory

To add all contents of current directory (again, recursively) call instead:

zip -r *

While to add two or more directories (but not all) in current directory — list them:

zip -r directory_a directory_b directory_c

Call just zip to see all switches, options etc.

chown: Recursively change owner of all files and folders

Sometimes QNAP changes file owner to admin:administ (actually to admin:administratorsadmin user in administrators group) which may cause some troubles on certain FTP operations when you’re logged in to QNAP’s FTP server with user different than admin (using this user to operate on FTP is a quite great mistake and you should always use other, less privileged user for this).

Using chown command you can easily fix this.

Read More “chown: Recursively change owner of all files and folders”

Fix problems with sudoers or file on QNAP

Root / power-user configuration on QNAP devices is a little bit different (quite weird) than this, what you can find on most Unix/ Linux systems. And sometimes you may be hit with error messages like “admin is not in the sudoers file. This incident will be reported“, “ must be owned by uid 0” etc. Here are some tips on what to do in this case.

For second error, claiming that file uid isn’t 0, first go to folder containing this file (/opt/libexec/ on QNAP TS-210) and ls -ls to check, who is current user of it. It should be admin:administ (actually admin:administrators, but ls -ls chops names to 8 characters).

If it isn’t, change ownership of this file and /opt/etc/sudoers folder, by executing:

chown admin:administrators /opt/libexec/
chown admin:administrators /opt/etc/sudoers

As for first error, saying, that admin is not in the sudoers file, you may try to execute sudo usermod -aG sudo,adm admin, but this will most likely fail on QNAP.

If it does, then fix this manually as described in here:

  1. Execute visudo command to edit /opt/etc/sudoers.tmp file.
  2. Scroll down contents of this file, until you reach root ALL=(ALL) ALL.
  3. Hit Enter to add a new line below and write admin ALL=(ALL) ALL.
  4. Hit Esc, enter wq and hit Enter to save file and exit forsakend vi editor.

This is the only solution, that I found working on my QNAP TS-210.

All others, that required using GRUP, were impossible, as you don’t have access to GRUP during QNAP boot.

Change prompt and enable command auto-completion [updated]

I really like some simple extensions and changes to command line in Linux. An ability to enable command auto-complete, commands history navigation and changing prompts look in particular.

However, not every console is suited with these changes, so I wrote this simple article to keep all my how-tos around Linux command line in one place.

Read More “Change prompt and enable command auto-completion [updated]”

Get WebSVN to QNAP

This guide assumes, that you have svn already installed on your QNAP, fully configured and working like a charm, and you just want to enhance it with web client (WebSVN). You can use this guide also on any other server, than QNAP, but keep in mind, that it contains some QNAP-specific problems.

Keep in mind: WebSVN (as good as all other alternatives mentioned in the end of this text) are read-only web SVN clients! You can do a lot of useful stuff on your repos, but forget about committing or anything similar that requires write access or changing repository structure.

Read More “Get WebSVN to QNAP”

Installing and configuring FTP server on on Ubuntu 12.04 and adding users

As for good FTP server for Ubuntu I’ve choosen vsftp server, though it has some glitches (more here), after fairly good response in the Internet. Many guides shows how to configure and use vsftp on local users, though giving them, by default, access only to their home folder. And allowing them to access server via SSH.

Which is not, what we want in most cases.

I’ve found a good guide, which shows you how to add ftp users with access to folder inside WWW root only.

Read More “Installing and configuring FTP server on on Ubuntu 12.04 and adding users”

Fixing 500 OOPS: vsftpd: refusing to run with writable root inside chroot()

Unfortunately, Ubuntu 12.04 LTS has vsftpd (very famous FTP server) in version 2.3.5 as latest one, which is affected by well know problem of disallowing users to login and throwing

500 OOPS: vsftpd: refusing to run with writable root inside chroot()

error, when using default vsftpd configuration (including a must-have chroot_local_user=YES setting).

There are few ways of working around this problem and most of them are discussed in this post.

Read More “Fixing 500 OOPS: vsftpd: refusing to run with writable root inside chroot()”

Finding Apache installation path and configuration file

There are several ways to determine, where Apache has been installed on your Linux/Unix system and what are other imporant paths for it (WWW root, configuration etc.). You can use this nice blog entry, which in general means executing ps -ef | grep apache to determine path and then running /usr/sbin/apache2 -V with proper path (replace /usr/sbin/ part) to determine Apache configuration details.

You can also use DistrosDefaultLayout page in Httpd Wiki to find default path layout for your particular operating system.

If everything else fails, try to help yourself with Installation and setup of the Apache Web Server (Linux) document.

Copy large folders using command-line with progress indication

By many sources cp is mentioned as the fastest way to copy large filesets. And the only fault of it, is that it does not provide an easy way to see progress of copy process. This post discusses various ways of fixing this problem. Keep in mind, that this post is (again) QNAP-optimized, meaning that it mostly focuses on solutions available on my old, lame QNAP TS-210 NAS system. It only points out other methods, that are not available on this very limited edition of Linux.

Read More “Copy large folders using command-line with progress indication”

Scanning all incoming traffic. Proper use of tcpdump

I had to do some strange listening stuff with even more strange Chineese GPS locator, that was weird enough to use UDP protocol only. Since there was absolutely no technical guide for these devices (at least, when I was looking for them), I had to listen for everything on every port of my local server to see, what this damn box is actually sending.

Since I’m kind of Linux newbie, I asked this Unix & Linux question and got answer enough worth for me, that I decided to put some summary of them to my own blog.

Read More “Scanning all incoming traffic. Proper use of tcpdump”

screen: Force program to continue after logging-off from the console

So, there I was… needing to have any solution, that will allows me to write my very own port listener. Since the only language, in which I am handy is PHP, I was forced to be able to run PHP script without interruption, 24 hours a day, 7 days a week. That was a bit of challenge for me, given my quite very limited Linux knowledge, but — as they say — the only thing not possible in IT is to open an umbrella in your ass! :>

Read More “screen: Force program to continue after logging-off from the console”

Installing SVN on QNAP using IPKG (Optware)

This article is based on information provided by QPKG package created for SVN by noski and on QNAP Wiki article about SVN and of course a piece of my experience. But since SVN is relatively easily to install by-hand (so you don’t actually need QPKG package) and since Wiki article about SVN is outdated / contains some garbage (directory /share does note belong to /dev/ram!), I decided to write my own guide.

Read More “Installing SVN on QNAP using IPKG (Optware)”

Fix for problem with mixing USB shares on QNAP

Most QNAPs randomly mounts USB disk shares. I.e. you can have disk attached to left USB port as USBDisk1, second as USBDisk2 and after reset — changed together. This causes many problems, where being unable to write some script accessing particular disks could be named at first. There isn’t an easy way to work around it. The only solution I found out was to write an script that resides in flash memory (therefore is called upon each restart of QNAP) and that mounts disks under shares similar to their disk labels.

Read More “Fix for problem with mixing USB shares on QNAP”

Remove non-empty directory on QNAP or Linux

You may try to use rm -rf [directory] to delete given directory along with all its content (including all subdirectiories and all files). Use this with caution, to not end up deleting all files on your root! :>

Note, that on QNAP (but not on regular Linux) you have to start your session as admin user, as you cannot use su command to become root. If you try this, you’ll end up with error su: user root does not exist.

Introduction to bash scripts

While playing with some extra features on my newly purchased QNAP TS-210 at some point I was forced to finally write some bash script to be able to control things, that are uncontrollable via administration panel. For this reason I had to learn myself at least basics of bash, that is installed on my QNAP. I used floppix page and Wiki as a base for my learning process (and source for this article), however I had to write down my own memo-list to be able to quickly find, what I’m looking for.

Read More “Introduction to bash scripts”

No Samba access after password change

Let us understand it. Windows is stupid and idiotic system. Suppose, you store (remember) your NAS’s Samba username and password, so you don’t have to provide it, each time you access your local network share. If you thenchange your user password, Windows either won’t detect the fact that password has changed or, even if it detect it, it won’t show you login/password dialog box to provide new one. Instead, it continue to provide NAS with wrong (outdated) password.

Read More “No Samba access after password change”