Static IP address in Raspbian

If you installed Raspbian on RaspberryPi and tried to set static IP address using /etc/network/interfaces  you have noticed that it doesn’t work.

Problem is, Raspbian is using dhcpcd – a DHCP client for setting IP address. You can try to:

  • remove dhcpd daemon and set the address in interfaces  file, or
  • set the static IP address for your RaspberryPi in your DHCP server.

But, the really best and simplest solution is to set static IP address thru dhcpcd.

Open /etc/dhcpcd.conf  file and add this content at the end of the file:

static ip_address=192.168.1.10/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

This IP address is then set for eth0  interface. If you have more than one interface, you need to add interface interface_name  before static ip_address line:

interface wlan0
static ip_address=192.168.1.11/24
...

Renaming default username in Raspian (on RaspberryPi)

When you install Raspbian on RaspberryPi, default username is pi. Often, you want to change it to custom username (and keep uid 1000). Here’s how to change it, along with user’s home directory:

usermod -l new_username -m -d /home/new_username pi
  • -l new value of the login name
  • -m move contents of the home directory to the
    new location
  • -d new home directory for the user account

Also, change default user’s group name:

groupmod -n new_username pi

To successfully change it, pi user can’t be logged in. You have to log in as root (or another user in sudo group) and execute above commands.

Forwarding mail in ISPConfig 3 without leaving copy

In ISPConfig 2 there was a little nice feature for mail user where you could easily forward mail to another mail address, with or without leaving a copy on server:

ispconfig1

It was really useful feature because user could always forward mail and leave a copy (or not) on server with single click. ISPConfig 3 does not have that feature (well, it has, but you can’t easily select to keep copy or not) but it has custom for mailbox where you can define filter using Sieve.

Continue reading

Enabling swap in Linux

In Linux, when physical memory (RAM) is full, inactive pages in memory are moved to the swap. Swap space is located on hard drive, which is significantly slower than RAM. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. However, it’s very useful when you need a little bit more RAM for a brief piece of time, like compiling software etc.

Many VPS providers (like Digital Ocean) don’t enable swap automatically, and you need to enable it by yourself. Here’s how:

Continue reading