петък, 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







Няма коментари:

Публикуване на коментар