Month: March 2017

  • Linux File Permissions

    Linux File Permissions

    Explanation

    For example: dwrxr–r– You can split this in 4 segmenst: d wrx r– r–
    d means the name is a directory. wrx is the first of 3 permission segments, and represents the owner. The next segment is for the same group users, and the last is for other users like guests.

    Above stands for: directory, writable, readable, exacutable. Readable (by same group user), Not writable (by same group user), only readable by other (guest) users.

    Change permissions

    Change fileperission on newfile.txt

    chmod 660 newfile.txt

    660 is a binary notation which represents the permission level.
    7 Read-write-execute
    6 Read-write
    5 Read-execute
    4 Read
    3 Write-Execute
    2 Write
    1 Execute
    0 No permissions

  • Pi-Hole DNS AdBlocker

    Pi-Hole DNS AdBlocker

    Install

    Run the following script:

    curl -sSL https://install.pi-hole.net | bash

    Update

    Just run the following script:

    pihole -up
  • Running Ubuntu full-screen in Virtualbox

    Running Ubuntu full-screen in Virtualbox

    Install Ubuntu in Virtualbox. It’s not directly possible to run Native full-screen resolution.

    Follow the next steps to solve this problem:

    • Select from ‘Devices’ in the titlebar the option ‘Guest additions’.
    • Reboot the virtual machine.
    • Press the host-key (by default right-CTRL) and F simultainously.

    The screen turns full-screen Ubuntu in native resolution.

  • Traccar installation on Raspberry Pi

    Traccar installation on Raspberry Pi

    Download and install Traccar

    Download Traccar

    wget https://github.com/tananaev/traccar/releases/download/v3.4/traccar-linux-arm-3.4.zip

    Unzip downloadfile

    unzip traccar-linux-arm-3.4.zip

    Remove zipfile

    rm traccar-linux-arm-3.4.zip

    Run install script

    sudo ./traccar.run

    Start Traccar Server

    sudo java -jar /opt/traccar/tracker-server.jar

    Optional configuration

    Make autostart on boot

    Start crontab

    crontab -e

    Add following line to the bottom of the file

    @reboot /usr/bin/nohup /usr/bin/java -jar /opt/traccar/tracker-server.jar

    Exit crontab and save file

    Reboot Raspberry Pi

    sudo reboot

    (Source: http://www.forum-raspberrypi.de/Thread-tutorial-tracking-server-mit-traccar)

    Use an external MySQL database like Synology

    By default Traccar Server uses embedded H2 database. If you want to use MySQL database engine you need to replace following lines in configuration file:

    <entry key='database.driver'>org.h2.Driver</entry>
    <entry key='database.url'>jdbc:h2:/home/user/Documents/traccar/target/database</entry>
    <entry key='database.user'>sa</entry>
    <entry key='database.password'></entry>

    Configuration parameters for MySQL (replace 127.0.0.1, [DATABASE], [USER], [PASSWORD] with appropriate values):

    <entry key='database.driver'>com.mysql.jdbc.Driver</entry> 
    <entry key='database.url'>jdbc:mysql://127.0.0.1:3306/[DATABASE]?allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=latin1&amp;sessionVariables=sql_mode=ANSI_QUOTES</entry>
    <entry key='database.user'>[USER]</entry> 
    <entry key='database.password'>[PASSWORD]</entry>

    NOTE: Traccar will create tables for you, but you need to create database with selected name by yourself.
    (source: https://www.traccar.org/mysql/

    Configuration of devices

    RF-V16

    Device transmits on port 5005. Traccar listens default to this protocol (H02) on port 5013. Make port forward in router 5005 → 5013 or swap port numbers in .xml configuration file.

    Known issues

    Using Synology MySQL database (update)

    = (UPDATE) PROBLEM SOLVED in version 3.4 = You can make version 3.3 work with the Synology MySQL database with a small modification. Change in the .XML configurationfile ‘UTF-8’ to ‘latin-1’. The developer know this problem and it will be solved in the near future.

    Version 3.2 works great without this specific modifcation

  • SSH port change

    SSH port change

    Ubuntu / Debian

    Open the SSH configuration file with your favorite text editor and find the lines that specifies the SSH port.

    nano /etc/ssh/sshd_config

    Default value:

    #Port 22

    Uncomment the relevant line by removing the # sign and change the default port 22 to the one that you want to use. In this article we will use port 1012.

    Port 1012

    Save the changes and exit.

    Restart SSH service

    Restart the SSH service for the changes to take effect.

    service sshd restart
  • OpenVPN Client installation in Ubuntu

    Open the terminal.
    Update the software repositories and install the network manager.

    $ sudo apt-get update
    $ sudo apt-get install network-manager-openvpn

    Copy your VPN files  (*.ovpn and certificate files) to a known location on your computer.

    Open network connections.
    Edit connections
    Load configuration
    Select your  *.ovpn file.

  • Bookmark network share

    Open nautilus explorer.
    Go to network → Connect to server.
    Enter path, for example:

    smb://192.168.0.10

    Enter username, domain and password.
    Rename the bookmark as you wish with right-click → rename.

  • Missing titlebar at Zorin

    When you install Zorin, it could be possible that you don’t see a title bar at the top of you screen. This is because of an error in the Compiz window manager.
    You can avoid this problem by using Metacity instead.

    Follow the next steps:

    • Log off
    • Click on the blue Z next to your username
    • Select Gnome flashback Metacity
    • Log back in

    Now you’re logged in to a Gnome enviroment with the Metacity window manager.

  • Keepass for Ubuntu

    Add the repository to the software centre. The standard version in software centre is old.

    ppa:jtaylor/keepass

    Search for ‘KeepassX’ and install.

    Auto fill-in

    By default, you can’t fill in the user credantials automatically. To make this possible, you have to install another program called ‘xdotool’.

    $ sudo apt-get install xdotool
  • Ubuntu 14.04 default brightness

    Laptop users still have the backlight issue in Ubuntu 14.04. Every time Ubuntu boots up you get the maximum level of screen brightness.

    Here’s a workaround by adding a startup script which will automatically adjust screen brightness when Ubuntu boots up.

    To get started:

    Preparation: Open your file browser and navigate to “Computer→ sys → class → backlight” directory. You’ll see two or three folders there.

    In each folder there’s a file called actual_brightness, you can see its content (brightness value) through the thumbnail icon.

    actual-brightness

    Remember them and do:

    1.  Change your screen brightness through Fn + Arrow key.
    2. Check out the actual_brightness files in each folder (Re-open each folder to refresh the value).
    3. Does the value change?
    4. Remember the folder name in which the value of actual_brightness changes.
    5. Replace acpi_video0 in below commands with that folder name

    1. Press Ctrl+Alt+T on keyboard to open the terminal. When it opens, run the command below will give you the maximum level of your laptop backlight:

    $ cat /sys/class/backlight/acpi_video0/max_brightness

    Mine is 9, so I can set backlight level from 0 to 9.

    2. Run the command below one by one. You’ll get the super user privilege and open the /etc/rc.local file, a script executed at the end of each multiuser runlevel, with gedit editor.

    $ sudo -i
    $ gedit /etc/rc.local

    Add the line below before the last. Change the number 0 to the brightness level you want.

    $ echo 0 > /sys/class/backlight/acpi_video0/brightness
    

    That’s it. Enjoy!

    (source: http://ubuntuhandbook.org/index.php/2014/04/save-screen-brightness-settings-in-ubuntu-14-04/)