вторник, 22 септември 2020 г.

Setup static ip address on Ubuntu 20.04.1

sudo vim /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.1
dns-search google.bg

----

sudo vim /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    eth0:
#      dhcp4: true
      addresses: [192.168.0.100/24]
      gateway4: 192.168.0.1
      nameservers:
        addresses: [192.168.0.1]
  version: 2

sudo netapply try
# sudo netapply

----

nmap 192.168.1.0/24
sudo nmap 192.168.1.0/24
nmap -sn 192.168.1.0/24
sudo nmap -sn 192.168.1.0/24
sudo nmap -Pn 192.168.1.100

събота, 28 май 2016 г.

How to use VIM for development with C language

How to use VIM for development with C language


Installing Tools

(Next instructions are typed in console)
1. Install VIM:
sudo apt-get install vim

2. Install ctags tool for indexing files:
sudo apt-get install ctags

3. Enter in directory:
cd ATmega32A_GCC_dev

4. Indexing (tag file) for only C and H source files with ctags in current directory: 
ctags -R *.c *.h

4a. Indexing (tag file) for all source files with ctags in current directory:
ctags -R .5. View index file:
view tags

Configure VIM to development tool

1. Open Vim with any source file from current directory and type
vim main.c

(Next instructions are typed in VIM)
2. Set index file to VIM:
:set tags=~/Desktop/ATmega32A_GCC_dev/tags

3. Search where is defined variable or function or any with
Ctrl+]
4. Return backward
Ctrl+t

5. Type any you search in <pattern> place
:tag /<pattern>

5a. Search main
:tag /main

6. Mark to search press shift+8 this is sign *

7. Next marked searching press n, n, n






Help:
http://vim.wikia.com/wiki/Browsing_programs_with_tags
http://vim.wikia.com/wiki/Single_tags_file_for_a_source_tree

вторник, 19 април 2016 г.

Install Linux Debian on MacBook Air 13" 2012

 

Multi boot OS with MacBook Air 5.2 13" 2012: Linux Debian version 8.2 x64,
Mac OS X 10.10.1,
Windows 7 x64.



How to manage disk...

How to multiboot (tripleboot) with Linux, MacOS, Windows systems:

How to install Linux:
How to install MacOS:
How to install Windows:

Linux Debian version 8.2 x64


View version mac/pc computer machine:
# sudo dmidecode -s system-product-name


WIFI DRIVER:
Install Driver for wifi support.
Connect with LAN network to download and install wifi driver package.

View debian version:
# cat /etc/debian_version

Download driver package:
# wget http://http.us.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-brcm80211_0.36+wheezy.1_all.deb

Install driver:
#sudo dpkg -i firmware-brcm80211_0.36+wheezy.1_all.deb

Reboot system:
# sudo reboot



TOUCHPAD DRIVER  
Install Driver for touchpad with multitouch support.
Press button with one finger: Mouse Left Button.
Press button with two finger: Mouse Right Button.
Press button with three finger: Mouse Middle Button.

Install multitouchpad support:
# sudo apt-get install libmtdev1 mtdev-tools xserver-xorg-input-multitouch

Backup and remove old touchpad driver:
# mv 50-synaptics.conf /home/<your_user_name>/Downloads/

Install gnome tweak tool:
# sudo apt-get install gnome-tweak-tool

# sudo echo blacklist brcm80211 >> /etc/modprobe.d/broadcom-sta-common.conf

# sudo reboot



GRAPHICAL DEVELOPMENT
INSTALL GTK+:
Install needed packages:
# sudo apt-get install build-essential

View versions gcc and g++:
# gcc -v
# g++ -v

Install gtk+:
# sudo apt-get install libgtk2.0-dev
# pkg-config --libs gtk+-2.0# pkg-config --cflags gtk+-2.0

Compile:

# g++ example1.cpp `pkg-config --libs gtk+-2.0` `pkg-config --cflags gtk+-2.0` -o example1

Execute:
# ./example1

INSTALL QT:
Install needed packages:
# sudo qt-sdk


Install more software:

Add repository for wheezy:
# sudo apt-get install python-software-properties

Add repository for jessie:
# sudo apt-get install software-properties-common

Install Sega Genesis / Mega drive emulator:
# wget https://sourceforge.net/projects/gens/files/Gens%20for%20Linux/Gens%202.15.5/gens_2.15.5_i386.deb/download
# mv download gens_2.15.5_i386.deb
# sudo dpkg -i gens_2.15.5_i386.deb

Install PS1 emulator:
# sudo add-apt-repository ppa:gregory-hainaut/pcsx2.official.ppa
# sudo apt-get update
# sudo apt-get install pcsxr

Install PS2 emulator:
# sudo add-apt-repository ppa:gregory-hainaut/pcsx2.official.ppa
# sudo apt-get update
# sudo apt-get install pcsx2

Uninstall/remove default archivator/extractor:
# sudo apt-get remove xarchiver

Install archivator/extractors:
# sudo apt-get install p7zip-full
# sudo apt-get install zip
# sudo apt-get install unzip
# sudo apt-get install file-roller

# sudo apt-get install unrar

Ziping file, go to folder and zip all files and folder into zip file:
$ zip -r filename *


Unrar file or partial files:
$ unrar e filename01.rar


Install i2c tools and development library:
# sudo apt-get install i2c-tools

View all i2c devices on your linux system with:
# sudo i2cdetect -l

Install Open VPN and configure connection from: Boris Gutsev part1, part2:
# sudo apt-get install openvpn
 

Mac OS X 10.10.1


Windows 7 x64

 




вторник, 29 март 2016 г.

How to use GPIO Raspberry Pi 2 (Model B v1.1 2014) based on Raspbian OS

How to use GPIO Raspberry Pi 2
(Model B v1.1 2014)
based on Raspbian OS




Basic using GPIO with shell, example with led blink

J8 header connector on Raspberry Pi 2 Model B v1.1 2014

Connect Led between GPIO4 and GND with 1K resistor.



Make sure root to gpio access:
$ sudo su

Command line probe:
# echo "4" > /sys/class/gpio/export
# echo "out" > /sys/class/gpio/gpio4/direction
# echo "1" > /sys/class/gpio/gpio4/value
# echo "0" > /sys/class/gpio/gpio4/value
# echo "4" > /sys/class/gpio/unexport


Create file: "ledblink.sh" with contains:

#---------------------------------------------------------------------------------
# reserve resources export gpio_4
echo "4" > /sys/class/gpio/export
# make gpio_4 to ouput
echo "out" > /sys/class/gpio/gpio4/direction
# set gpio_4 value to logical '1'
echo "1" > /sys/class/gpio/gpio4/value
# wait 2 seconds
sleep 2s
# set gpio_4 value to logical '0'
echo "0" > /sys/class/gpio/gpio4/value
# wait 2 seconds
sleep 2s
# set gpio_4 value to logical '1'
echo "1" > /sys/class/gpio/gpio4/value
# wait 2 seconds
sleep 2s
# set gpio_4 value to logical '0'
echo "0" > /sys/class/gpio/gpio4/value
# wait 2 seconds
sleep 2s
# release reserved resources and unexport gpio_4
echo "4" > /sys/class/gpio/unexport
#---------------------------------------------------------------------------------

Save and close file.

Make file to executable:

chmod +x ledblink.sh

Execute shell script:
./ledblink.sh





понеделник, 28 март 2016 г.

Run Raspberry Pi 2 (Model B v1.1 2014) with Raspbian OS

Run Raspberry Pi 2 (Model B v1.1 2014) with Raspbian OS

Made by Mac OS X 10.10

Need tools:
1. Raspberry Pi.
2. MicroSD Card (minimum 8GB, recommend 16GB) with adaptor to SD card factor.
3. Power supply usb cable or mobile cell phone usb adapor with 5V.

Download torrent (current version is 1.9.0, 2016-03-18) Noobs from:
https://www.raspberrypi.org/downloads/noobs/

https://downloads.raspberrypi.org/NOOBS_latest.torrent

Download format tool for sdcard:
https://www.sdcard.org/downloads/formatter_4/eula_mac/

SDFormatter:
a) Insert sdcard.
b) Option: Logical Address Adjustment - NO.
c) Choose radio button on "Overwrite Format".
d) Write any name.
e) Press button Format.

Extract downloaded "NOOBS_v1_9_0.zip" and copy all contains on formatted sdcard.

Connect LAN cable with Internet in Raspberry Pi ethernet port.
Put sdcard in Raspberry Pi and plug usb power.
Choose to install OS Raspbian.

When the OS is installed you have Rasperry Pi with Debian. You can install software on your debian with next commands:

How to install applications:
Root access
$ sudo su

Make update all current applications

# sudo apt-get update

Make upgrade all current applications
# sudo apt-get upgrade

Install Gparted storage partition graphic tool
# sudo apt-get install gparted

Install Vim command line editor
# sudo apt-get install vim

Install tools for development gcc
# sudo apt-get install build-essential

Install Atmel AVR development libraries and tools
# sudo apt-get install gcc-avr avrdude

Install Gedit gnome graphic editor
# sudo apt-get install gedit

Install Git source control version system
# sudo apt-get install git-all

Install Eclipse integrated development tool
# sudo apt-get install eclipse

Install Geany development editor tool
# sudo apt-get install geany

Install Qt integrated graphical development tool
# sudo apt-get install qt-sdk

Install Java Development
# sudo apt-get install default-jdk

Install PDF Viewer
# sudo apt-get install evince

Install VLC Video player
# sudo apt-get install vlc

Install Totem Video player and start it
# sudo apt-get install totem
$ totem

Install Xine Video player and configure it
# sudo apt-get install xine-ui
or
# sudo aptitude install gxine
$ xine
configure Xine: right mouse click: Settings -> Setup
menu gui tab: Configuration experience level: Advanced
menu subtitles tab: encoding of the subtitles: cp1251
Apply
OK
$ gxine
configure GXine: File -> Configure -> Preferences...
menu gui tab: experience_level: Beginner -> Advanced
menu subtitles tab: separate tab: src_encoding: cp1251
Save
Close

Install Clementine Audio player
# sudo apt-get install clementine

Install other PDF Viewer
# sudo apt-get install gv

How to enable Audio Analog or HDMI:

# sudo su
# raspi-config
select Advanced Options -> Audio:
1 Force 3.5mm ('headphone') jack
2 Force HDMI
<Enter>
<Tab><Tab>
Finish
<Enter>

How to remove/uninstall applications:
# sudo apt-get remove gv

How to restart/reboot system:
# sudo reboot

How to shutdown/turn off system:
# sudo halt


How to setup IDE QT to graphic development:
After install Qt IDE, compiling tools and git
# sudo apt-get install build-essential qt-sdk git-core

If need execute next line:
# sudo apt-get install emdebian-archive-keyring

# gcc -v
You can view where is located arm-linux-gnueabihf compiler and what is current version of compiler:

==============================================
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.9/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Raspbian
4.9.2-10' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--enable-gnu-unique-object --disable-libitm --disable-libquadmath
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf/jre
--enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-armhf
--with-arch-directory=arm
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc
--enable-multiarch --disable-sjlj-exceptions --with-arch=armv6
--with-fpu=vfp --with-float=hard --enable-checking=release
--build=arm-linux-gnueabihf --host=arm-linux-gnueabihf
--target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.9.2 (Raspbian 4.9.2-10)
==============================================


Path to compiler is: /usr/bin/arm-linux-gnueabihf-gcc

Navigate to: Menu | Programming | Qt Creator
Navigate to: Tools | Options | Compilers | Add | GCC
   Name: arm_bcm2836_rpicompiler
   Compiler path: /usr/bin/arm-linux-gnueabihf-gcc

Press buttons: Apply | OK and go to development





How to make usb bootable installer with FreeNAS

How to make usb bootable installer with FreeNAS

Used OS: Mac OS X 10.10

Mac OS X make boot instaler with FreeNAS
https://doc.freenas.org/9.3/freenas_install.html

Download FreeNAS image installer from here:
http://download.freenas.org

I'm using "FreeNAS-9.3-STABLE-201602031011.iso"
http://download.freenas.org/9.3.1/STABLE/201602031011/x64/FreeNAS-9.3-STABLE-201602031011.iso

Put your flash on usb port

Open terminal and type commads:

View unmount of your flash all volumes on disk1 was successful
$ diskutil unmountDisk /dev/disk1

Make usb boot installer
$ sudo dd if=FreeNAS-9.3-RELEASE-x64.iso of=/dev/rdisk1 bs=64k


петък, 25 март 2016 г.

Migration FreeNAS to Linux (Debian/Ubuntu)

FreeNAS -> Linux Ubuntu Server 14.04.4


SSH REMOTE ACCESS
Open Terminal from Host PC
$ ssh pesho@192.168.1.107
(pass:)
On Ubuntu Server 14.04.4 login as sudo
$ sudo su

Linux SOURCES for update system from NET 
# sudo chmod 644 /etc/apt/source.list

# vim /etc/apt/source.list

Contain file "source.list", comment with # all cdrom sources
================================================
#

# deb cdrom:[Ubuntu-Server 14.04.4 LTS _Trusty Tahr_ - Release amd64 (20160217.1)]/ trusty main restricted

#deb cdrom:[Ubuntu-Server 14.04.4 LTS _Trusty Tahr_ - Release amd64 (20160217.1)]/ trusty main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://bg.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://bg.archive.ubuntu.com/ubuntu/ trusty main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://bg.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://bg.archive.ubuntu.com/ubuntu/ trusty-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://bg.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://bg.archive.ubuntu.com/ubuntu/ trusty universe
deb http://bg.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://bg.archive.ubuntu.com/ubuntu/ trusty-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://bg.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://bg.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://bg.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://bg.archive.ubuntu.com/ubuntu/ trusty-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://bg.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://bg.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu trusty partner
# deb-src http://archive.canonical.com/ubuntu trusty partner

## Uncomment the following two lines to add software from Ubuntu's
## 'extras' repository.
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
# deb http://extras.ubuntu.com/ubuntu trusty main
# deb-src http://extras.ubuntu.com/ubuntu trusty main
================================================

DOWNLOAD, INSTALL PACKAGE TOOLS and etc...
If need dependency follow this: sudo apt-get build-dep <package>

Install git on server
# sudo apt-get install git-all

Install sshfs to mount remote filesystem by ssh
# sudo apt-get install sshfs

Install samba to share folder by smb/cifs
# sudo apt-get install samba

Install ftp server
# sudo apt-get install vsftpd

Install process activity monitor
ccsudo apt-get install htop
 Download TeamViewer 32bit:
wget http://download.teamviewer.com/download/teamviewer_i386.deb
# sudo dpkg -i teamviewer_i386.deb
# sudo apt-get install build-dep
# sudo apt-get install -f

Download TeamViewer 64bit:
wget http://download.teamviewer.com/download/teamviewer_amd64.deb
# sudo dpkg -i teamviewer_i386.deb
# sudo apt-get install -f
(if you have problem with old architecture and x64 you may need install:
# sudo dpkg --add-architecture i386
# sudo apt-get install build-dep
# sudo apt-get install update
# sudo apt-get install upgrade -f
and run to install again teamviewer:
# sudo dpkg -i teamviewer_i386.deb
)
INSTALL GCC, ZFS RAID FreeBSD filesystem and mount it
https://dineshjadhav.wordpress.com/zfs-file-system/

# sudo apt-get install build-essential gawk alien fakeroot linux-headers-$(uname -r)

# sudo apt-get install zlib1g-dev uuid-dev libblkid-dev libselinux-dev parted lsscsi

# sudo apt-add-repository ppa:zfs-native/daily
 
# sudo apt-get update
 
# sudo apt-get install dkms
 
# sudo apt-get install debootstrap ubuntu-zfs

*******************************************************************************************************************************
# sudo apt-get install lsb-release

From here:
# sudo apt-get install build-essential gawk zlib1g-dev uuid-dev vim-nox python-software-properties
# sudo add-apt-repository ppa:zfs-native/stable

# sudo apt-get update
 
# sudo apt-get upgrade
 
# sudo apt-get install debootstrap spl-dkms zfs-dkms ubuntu-zfs 
This proccess is LONGER

*******************************************************************************************************************************
(not restrict only if needed install sudo apt-get install debian-zfs)
# /sbin/modprobe zfs

(not restrict only if needed install sudo apt-get install mountall)
# sudo reboot

# zpool import
From here:

# sudo modprobe zfs
 
# dmesg | grep ZFS: 

# zpool import
   pool: HDD
     id: 9661848799974708397
  state: ONLINE
 status: The pool was last accessed by another system.
 action: The pool can be imported using its name or numeric identifier and the '-f' flag.
   see: http://zfsonlinux.org/msg/ZFS-8000-EY
 config:
    HDD         ONLINE
      mirror-0  ONLINE
        sda     ONLINE
        sdb     ONLINE
# zpool import -f -o altroot=/mnt HDD
# zpool list
NAME   SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
HDD   2.72T  1.24T  1.48T         -    23%    45%  1.00x  ONLINE  /mnt

# ls /mnt/HDD/


USERS and GROUPS permission access
Change access to own root, group root, -h -R recursive files, folders, sub
# sudo chown -hR root:root *
ADD USER with adduser, set password
ADD USER user=test_user, group=test_user; and own directory in /home/userdirectory
# adduser test_user

automatic create directory /home/test_user
add different groups

# addgroup writers
# addgroup readers
# addgroup executors
# addgroup camera
# addgroup television
# addgroup phone
# grouped camera_new
 
check group, test_adduser : test_adduser
# group test_user 
check group, uid=1002(test_adduser) gid=1002(test_adduser)
# groups=1002(test_adduser)

# id test_user
change and add user to new group test_user, test_adduser : test_adduser camera
# adduser test_user camera

check group, uid=1002(test_adduser) gid=1002(test_adduser) groups=1002(test_adduser),1006(camera)
# id test_user 
delete user from group
# deluder test_user camera 
check group, uid=1002(test_adduser) gid=1002(test_adduser) groups=1002(test_adduser)
# id test_user

# groupadd cameranew
 
# addgroup test_user3 camera_new
 
# id test_user3 

uid=1004(test_user3) gid=1010(test_user3) groups=1010(test_user3),1011(camera_new)
# addgroup cameranew2
 
# addgroup test_user3 cameranew2
 
# id test_user3 
uid=1004(test_user3) gid=1010(test_user3) groups=1010(test_user3),1011(camera_new),1012(cameranew2)

ADD USER with useradd, without pass
USER ADD user=newuser1, group=test_user; and own directory in /home/userdirectory
# useradd newuser1
# id newuser1
add different groups
VIEW USERS MODIFY
VIEW ALL EXIST USERS with groups and folders
# cat /etc/passwd
# view /etc/passwd
 
Modify users
# man usermod
DELETE EXIST USER
# userdel newuser1
# deluder test_user3
 

! DO NOT FORGET AFTER EVERY REBOOT LINUX SERVER YOU MUST MOUNT ZFS
On SERVER
# zpool list

# zpool import

# zpool import -f -o altroot=/mnt HDD

# zpool list

# ls /mnt/HDD/
CHANGE NETWORK SETTINGS, IP ADDRESS
Use DHCP Server Reservation MAC and IP ADDRESS from router
Warning: On my pc don't work sshfs (command for mount remote file system) with static ip address, and I don't understand why? But with dhcp sshfs I haven't any problem.

CONFIGURE FTP SERVER
Open configuration file:
# vim /etc/vsftpd.conf

In file content "/etc/vsftpd.conf", uncomment, remove symbol # before lines
Change line to:
================================================
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
ftpd_banner=Welcome to Ubuntu FTP server.
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
================================================

Restart FTP service:
# sudo apt-get install vsftpd

MAKE SHORTCUT LINK
Create shortcut source to destination is current folder:
# ln -s /mnt/HDD/data/ ./ 


CONFIGURE SAMBA TO SHARE FOLDER
Open configuration file:
# vim /etc/samba/smb.conf

In file content "/etc/samba/smb.conf", symbol # is used to comment lines
Change line to:
================================================
   usershare allow guests = noIn end of file add these lines:
# Enable PESHO SAMBA DATA SHARE
#[data]
#   comment = Samba Share
#   path = <path to share folder>
#   valid users = <user access login>
#   browseable = yes
#   read only = no
#   guest ok = no
[data]
   comment = Samba Share
   path = /mnt/HDD/data
   valid users = pesho
   browseable = yes
   read only = no
   guest ok = no

================================================

Restart samba service:
# sudo service smbd restart

You can test samba share from different OS:

Linux:
Open File Manager and type link:
smb://pesho@192.168.1.107

MacOS:
Open Finder and go to Connect to server:
smb://pesho@192.168.1.107

Windows:
Open Windows Explorer and type link:
\\192.168.1.107


SSHFS MOUNT / UNMOUNT, USE ONLY FROM CLIENT PC/MAC 
LINUX MOUNT# sudo sshfs -o allow_other pesho@192.168.1.107:/mnt/HDD/data/ /home/upinov/Documents/Server/
MAC OS X MOUNT
from here: https://osxfuse.github.io/
download and install osxfuse-2.8.3
download and install sshfs-2.5.0
# sudo sshfs -o allow_other pesho@192.168.1.107:/mnt/HDD/data/ /Users/upinov/Documents/Server 
# sudo sshfs -o allow_other,difer_permissions pesho@192.168.1.107:/mnt/HDD/data/ /Users/upinov/Documents/Server

LINUX/MAC OS X UNMOUNT mounted directory/folder/filesystem
View mounted
# mount

root@192.168.1.107:/mnt/HDD/pesho/Movies on /Users/upinov/Documents/Server (osxfusefs, synchronous)
# sudo umount /Users/upinov/Movies/Server
On HOST PC 
# mkdir ~/Documents/Server
# mkdir ~/Documents/Raychev
# sudo sshfs -o allow_other pesho@192.168.1.107:/HDD/data/ /home/upinov/Documents/Server/

# sudo sshfs -o allow_other pesho@78.90.14.3:/HDD/data/ ~/Documents/Server/

# sudo sshfs -o allow_other pesho@78.90.14.3:/HDD/data/_USERS_/Raychev/ ~/Documents/Raychev/


Linksys DHCP Reservation

Linksys DHCP Reservation
From here:
# ip address show
 
# ifconfig -a
 
# ip -s link show eth0
 
# cd /etc/network
 
# vim /etc/network/interfaces

Contain file "interfaces", comment with # all cdrom sources
================================================
sudo lshw -class network
  *-network
       description: Ethernet interface
       product: BCM4401-B0 100Base-TX
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: eth0
       version: 02
       serial: 00:15:c5:4a:16:5a
       size: 10MB/s
       capacity: 100MB/s
       width: 32 bits
       clock: 33MHz
       capabilities: (snipped for brevity)
       configuration: (snipped for brevity)
       resources: irq:17 memory:ef9fe000-ef9fffff


# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.11
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1 78.90.14.1 89.190.192.248
dns-search google.bg
================================================

# /etc/init.d/networking stop
# /etc/init.d/networking start
# /etc/init.d/networking restart
# sudo reboot
On physical server only: restart services
# ifdown eth0
# ifup eth0
On physical server only: enable/disable network adapter

Next isn't restrict
# sudo vim /etc/resolvconf/resolv.conf.d/base
# sudo resolvconf -u
# vim /etc/resolv.conf


Contain file "resolv.conf", comment with # all cdrom sources
================================================
### The IP addresses of nameservers ##
nameserver 192.168.1.1
nameserver 78.90.14.1
nameserver 89.190.192.248
nameserver 8.8.8.8
================================================

# sudo reboot

On HOST CLIENT PC
If you have error "connection reset by peer", "remote host has disconnected" try to mount ZFS on ubuntu server


# sudo sshfs -o allow_other pesho@192.168.1.107:/mnt/HDD/data/ /home/upinov/Documents/Server/

read: Connection reset by peer
or
remote host has disconnected
or
mount_osxfusefs: failed to mount /Users/upinov/Documents/Server@/dev/osxfuse0: Socket is not connected

Change network configuration from static to dhcp!



(FreeNAS -> Linux Debian 8.0.2) v1

(unformatted)

//On Debian Host PC: terminal login as root with Ctrl+Alt+F1
//login: root
//password:
apt-get install sudo
adduser pesho sudo
sudo reboot
sudo chmod 777 /etc/apt/source.list
vi /etc/apt/source.list

=============================================================================================================
#
# deb cdrom:[Debian GNU/Linux 8.2.0 _Jessie_ - Official amd64 DVD Binary-1 20150906-11:13]/ jessie contrib main

#deb cdrom:[Debian GNU/Linux 8.2.0 _Jessie_ - Official amd64 DVD Binary-1 20150906-11:13]/ jessie contrib main

deb http://ftp.bg.debian.org/debian/ jessie main
deb-src http://ftp.bg.debian.org/debian/ jessie main

deb http://security.debian.org/ jessie/updates main contrib
deb-src http://security.debian.org/ jessie/updates main contrib

# jessie-updates, previously known as 'volatile'
deb http://ftp.bg.debian.org/debian/ jessie-updates main contrib
deb-src http://ftp.bg.debian.org/debian/ jessie-updates main contrib
=============================================================================================================

sudo apt-get install vim
sudo apt-get install git-all

//http://zfsonlinux.org/debian.html
su -
//password:
sudo apt-get install lsb-release
wget http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_6_all.deb
sudo dpkg -i zfsonlinux_6_all.deb

//http://www.servercobra.com/freenas-to-ubuntu-initial-fileserver-setup-with-zfs/
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential gawk zlib1g-dev uuid-dev vim-nox python-software-properties
//sudo add-apt-repository ppa:zfs-native/stable
sudo apt-get install debian-zfs
/sbin/modprobe zfs
sudo apt-get install mountall
sudo reboot
zpool import


//https://github.com/zfsonlinux/pkg-zfs/wiki/HOWTO-install-Debian-GNU-Linux-to-a-Native-ZFS-Root-Filesystem
sudo modprobe zfs
dmesg | grep ZFS:

//https://www.freebsd.org/doc/handbook/zfs-zpool.html

zpool import


//root@debiansrv:~# zpool import
//   pool: HDD
//     id: 9661848799974708397
//  state: ONLINE
// status: The pool was last accessed by another system.
// action: The pool can be imported using its name or numeric identifier and the '-f' flag.
//   see: http://zfsonlinux.org/msg/ZFS-8000-EY
// config:
//    HDD         ONLINE
//      mirror-0  ONLINE
//        sda     ONLINE
//        sdb     ONLINE

root@debiansrv:~# #zpool import -o altroot=/mnt HDD
root@debiansrv:~# zfs list
//no datasets available

root@debiansrv:~# zpool import -f -o altroot=/mnt HDD
root@debiansrv:~# zpool list
//NAME   SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
//HDD   2.72T  1.24T  1.48T         -    23%    45%  1.00x  ONLINE  /mnt
root@debiansrv:~# ls /mnt
//HDD
root@debiansrv:~# ls /mnt/HDD/






// change access to own root, group root, -h -R recursive files, folders, sub
sudo chown -hR root:root *

//==================================================== ADD USER with adduser, set password ====================================================
// ADD USER user=test_user, group=test_user; and own directory in /home/userdirectory;
adduser test_user
// automatic create directory /home/test_user
// add different groups

addgroup writers
addgroup readers
addgroup executors
addgroup camera
addgroup television
addgroup phone
grouped camera_new

// check group, test_adduser : test_adduser
group test_user

// check group, uid=1002(test_adduser) gid=1002(test_adduser) groups=1002(test_adduser)
id test_user

// change and add user to new group test_user, test_adduser : test_adduser camera
adduser test_user camera

// check group, uid=1002(test_adduser) gid=1002(test_adduser) groups=1002(test_adduser),1006(camera)
id test_user

// delete user from group
deluder test_user camera

// check group, uid=1002(test_adduser) gid=1002(test_adduser) groups=1002(test_adduser)
id test_user

groupadd cameranew
addgroup test_user3 camera_new
id test_user3
//uid=1004(test_user3) gid=1010(test_user3) groups=1010(test_user3),1011(camera_new)
addgroup cameranew2
addgroup test_user3 cameranew2
id test_user3
uid=1004(test_user3) gid=1010(test_user3) groups=1010(test_user3),1011(camera_new),1012(cameranew2)

//==================================================== ADD USER with useradd, without pass ====================================================
// USER ADD user=newuser1, group=test_user; and own directory in /home/userdirectory;
useradd newuser1
id newuser1
// add different groups

//========================================================= VIEW USERS MODIFY =========================================================
// VIEW ALL EXIST USERS with groups and folders
cat /etc/passwd
view /etc/passwd

// Modify users
man usermod

//========================================================= DELETE EXIST USER =========================================================
userdel newuser1
deluder test_user3








(FreeNAS -> Linux Debian 8.0.2) v2

(unformatted)
//=================================================================================================
//== SSH REMOTE ACCESS ============================================================================
//=================================================================================================

// On Debian Host PC: terminal console login as root with Ctrl+Alt+F1
// login: root
// password:
Ctrl + Alt + F1

// login:
root

// pass:

// open ssh config to change root ssh remote access permissions
nano /etc/ssh/sshd_config

// change line:
PermitRootLogin without-password

// to:
#PermitRootLogin without-password
PermitRootLogin yes

// Save with
Ctrl + o
// Enter

// Exit with
Ctrl + x

// Restart ssh service
/etc/init.d/ssh restart
//[ ok ] Restarting ssh (via systemctl): ssh.service.

// view ip address
ifconfig

// change normal graphical mode
Ctrl + Alt + F7

//=================================================================================================
//== SUDO and SOURCES from NET ====================================================================
//=================================================================================================

// install sudo
aptitude install sudo

adduser pesho sudo
sudo chmod 777 /etc/apt/source.list
nano /etc/apt/source.list

// comment with # all cdrom sources
=============================================================================================================
#
# deb cdrom:[Debian GNU/Linux 8.2.0 _Jessie_ - Official amd64 DVD Binary-1 20150906-11:13]/ jessie contrib main

#deb cdrom:[Debian GNU/Linux 8.2.0 _Jessie_ - Official amd64 DVD Binary-1 20150906-11:13]/ jessie contrib main

deb http://ftp.bg.debian.org/debian/ jessie main
deb-src http://ftp.bg.debian.org/debian/ jessie main

deb http://security.debian.org/ jessie/updates main contrib
deb-src http://security.debian.org/ jessie/updates main contrib

# jessie-updates, previously known as 'volatile'
deb http://ftp.bg.debian.org/debian/ jessie-updates main contrib
deb-src http://ftp.bg.debian.org/debian/ jessie-updates main contrib
=============================================================================================================

// Save with
Ctrl + o
// Enter

// Exit with
Ctrl + x

sudo chmod 644 /etc/apt/source.list

//=================================================================================================
//== INSTALL PACKAGES TOOLS and etc ===============================================================
//=================================================================================================

#if need dependency follow this: sudo apt-get build-dep package

sudo apt-get install vim
sudo apt-get install git-all
sudo apt-get install htop

//=================================================================================================
//== INSTALL GCC, ZFS RAID FreeBSD filesystem and mount it ========================================
//=================================================================================================

// From here: http://zfsonlinux.org/debian.html
sudo apt-get install lsb-release
wget http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_6_all.deb
sudo dpkg -i zfsonlinux_6_all.deb

// From here: http://www.servercobra.com/freenas-to-ubuntu-initial-fileserver-setup-with-zfs/
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential gawk zlib1g-dev uuid-dev vim-nox python-software-properties
// sudo add-apt-repository ppa:zfs-native/stable
// LONG WAITING - next line
sudo apt-get install debian-zfs
/sbin/modprobe zfs
sudo apt-get install mountall
sudo reboot
zpool import

// From here: https://github.com/zfsonlinux/pkg-zfs/wiki/HOWTO-install-Debian-GNU-Linux-to-a-Native-ZFS-Root-Filesystem
sudo modprobe zfs
dmesg | grep ZFS:

// https://www.freebsd.org/doc/handbook/zfs-zpool.html

zpool import

//root@debiansrv:~# zpool import
//   pool: HDD
//     id: 9661848799974708397
//  state: ONLINE
// status: The pool was last accessed by another system.
// action: The pool can be imported using its name or numeric identifier and the '-f' flag.
//   see: http://zfsonlinux.org/msg/ZFS-8000-EY
// config:
//    HDD         ONLINE
//      mirror-0  ONLINE
//        sda     ONLINE
//        sdb     ONLINE

root@debiansrv:~# zfs list
// no datasets available

root@debiansrv:~# zpool import -f -o altroot=/mnt HDD
root@debiansrv:~# zpool list
//NAME   SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
//HDD   2.72T  1.24T  1.48T         -    23%    45%  1.00x  ONLINE  /mnt
root@debiansrv:~# ls /mnt
//HDD
root@debiansrv:~# ls /mnt/HDD/

//=================================================================================================
//== CHANGE NETWORK SETTINGS, IP ADDRESS and etc ==================================================
//=================================================================================================
// From here: http://www.cyberciti.biz/faq/howto-configuring-network-interface-cards-on-debian/

ip address show
ifconfig -a
ip -s link show eth0
cd /etc/network
chmod 777 interfaces
vim /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.1.11
netmask 255.255.255.0
gateway 192.168.1.1

chmod 644 interfaces

// !!!!!!! On physical server only: restart services !!!!!!!
# /etc/init.d/networking stop
# /etc/init.d/networking start
# /etc/init.d/networking restart
// !!!!!!! On physical server only: enable/disable network adapter !!!!!!!
# ifdown eth0
# ifup eth0

sudo reboot

cd /etc
chmod 777 resolv.conf
vim /etc/resolv.conf

### The IP addresses of nameservers ##
nameserver 78.90.14.1
nameserver 89.190.192.248
nameserver 192.168.1.1
nameserver 8.8.8.8

chmod 644 resolv.conf

//=================================================================================================
//== USERS and GROUPS permission access ===========================================================
//=================================================================================================


// change access to own root, group root, -h -R recursive files, folders, sub
sudo chown -hR root:root *

//==== ADD USER with adduser, set password ====
// ADD USER user=test_user, group=test_user; and own directory in /home/userdirectory;
adduser test_user
// automatic create directory /home/test_user
// add different groups

addgroup writers
addgroup readers
addgroup executors
addgroup camera
addgroup television
addgroup phone
grouped camera_new

// check group, test_adduser : test_adduser
group test_user

// check group, uid=1002(test_adduser) gid=1002(test_adduser) groups=1002(test_adduser)
id test_user

// change and add user to new group test_user, test_adduser : test_adduser camera
adduser test_user camera

// check group, uid=1002(test_adduser) gid=1002(test_adduser) groups=1002(test_adduser),1006(camera)
id test_user

// delete user from group
deluder test_user camera

// check group, uid=1002(test_adduser) gid=1002(test_adduser) groups=1002(test_adduser)
id test_user

groupadd cameranew
addgroup test_user3 camera_new
id test_user3
//uid=1004(test_user3) gid=1010(test_user3) groups=1010(test_user3),1011(camera_new)
addgroup cameranew2
addgroup test_user3 cameranew2
id test_user3
uid=1004(test_user3) gid=1010(test_user3) groups=1010(test_user3),1011(camera_new),1012(cameranew2)

//==== ADD USER with useradd, without pass ====
// USER ADD user=newuser1, group=test_user; and own directory in /home/userdirectory;
useradd newuser1
id newuser1
// add different groups

//==== VIEW USERS MODIFY ====
// VIEW ALL EXIST USERS with groups and folders
cat /etc/passwd
view /etc/passwd

// Modify users
man usermod

//==== DELETE EXIST USER ====
userdel newuser1
deluder test_user3