January 2018

September 2017

Simple NAS with Samba and USB HDD

2017-09-25T10:49:12+00:00 September 25th, 2017|Ubuntu|

list all devices

bart@ubuntu:~$ dmesg

at the bottom find your device name in my case 500gb usb hdd as sdb

sd 6:0:0:0: [sdb] 976773168 512-byte logical blocks:500GB/465GiB)

create partition with fdisk on sdb hdd

sudo fdisk /dev/sdb

– click m for help than choose “p” to list existing partitions
– remove partition by pressing “d” and select partiton from the list
– “n” for new partiton “p” primary partition, number “1”
– save and exit “w”

format to ext4

sudo mkfs.ext4 /dev/sdb1

create directory for NAS in your desire location

bart@ubuntu:/mnt$ sudo mkdir NAS

mount hdd to directory /mnt/NAS/

sudo mount /dev/sdb1 /mnt/NAS/

find uuid for sdb1

sudo blkid /dev/sdb1

add USB HDD to permanent mount after reboot edit /etc/fstab

sudo nano /etc/fstab

add USB HDD to permanent mount after reboot edit /etc/fstab

#add at the bottom of the file than save (use your UUID)
UUID="5fc39f17-7763-4633-92e7-41e62c56e614" /mnt/NAS/ ext4 defaults,users,umask=0 0 0

test in by umount /dev/sdb1 and than use

sudo mount -a

create share folder /mnt/NAS/SHARENAME

sudo mkdir /mnt/NAS/SHARENAME

make sure about permissions

sudo chmod 777 /mnt/NAS/SHARENAME

edit /etc/samba/smb.conf

workgroup = workgroup
netbios name = NAS
server string = Samba Server %v
map to guest = Bad User
log file = /var/log/samba/log.%m
max log size = 50
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
preferred master = No
local master = No
dns proxy = No
security = User
interfaces = em1 lo
bind interfaces only = yes
hosts allow =
hosts deny =
path = /mnt/NAS/SHARENAME
valid users= louise, bart, backup
read only = no
create mask = 0777
directory mask = 0777
writeable = Yes

add user
useradd louise

add password for samba

sudo smbpasswd -a louise

restart service

sudo service smbd restart

magic! ?

July 2017

Mac OS X – File limits

2017-07-16T02:31:48+00:00 July 16th, 2017|Linux, Mac|

file handles opend:

lsof | cut -f 1 -d ' ' | uniq -c | sort

run maxfiles limit

launchctl limit maxfiles

it should give you result like:

bartron ➜ ~/Users/bartosz launchctl limit maxfiles
maxfiles 256 unlimited

to up limit files run:

bartron ➜ ~/Users/bartosz sudo launchctl limit maxfiles 512 20000

January 2017

Install 32bit TeamViewer with 64bit Ubuntu

2017-01-23T12:57:32+00:00 January 23rd, 2017|Linux, Ubuntu|

Install 32bit teamviewer in 64bit Ubuntu

sudo dpkg --add-architecture i386

Update Repository

sudo apt-get update

install additional packages

sudo apt-get install libdbus-1-3:i386 libasound2:i386 libexpat1:i386 libfontconfig1:i386 libfreetype6:i386 libjpeg62:i386 libpng12-0:i386 libsm6:i386 libxdamage1:i386 libxext6:i386 libxfixes3:i386 libxinerama1:i386 libxrandr2:i386 libxrender1:i386 libxtst6:i386 zlib1g:i386 libc6:i386

install downloaded package

sudo dpkg -i teamviewer*.deb

Configure Google Authenticator with Ubuntu

2017-01-23T11:36:10+00:00 January 19th, 2017|Linux, Security, Ubuntu|

Configure Google Authenticator with Ubuntu

sudo dpkg-reconfigure tzdata
sudo apt-get install ntpdate
sudo ntpdate 0.uk.pool.ntp.org
sudo apt-get install ntp

check settings via controls below

ntpq -p

Install google auth module

sudo apt-get install libpam-google-authenticator

choose user you want to configure auth for

su username

choose option Y

Do you want authentication tokens to be time-based (y/n)

scan barcode with google app or duo.com, follow instruction on the screen edit /etc/ssh/sshd_config and enable ChallengeResponseAuthentication to YES

ChallengeResponseAuthentication yes

edit /etc/pam.d/sshd and add below line at the top of the file

auth required pam_google_authenticator.so nullok

restart ssh service

sudo service ssh restart

How to add public key to remote host

2017-01-23T11:37:21+00:00 January 19th, 2017|Linux, Security, Ubuntu|

copy public key

cat keyname_pub.key | ssh user@host ‘cat >> ~/.ssh/authorized_keys’

on local machine edit /home/username/.ssh/config and add

Host choose_short_name
Port 22
User remote_user
IdentityFile /home/username/username_ssh_priv.key

How to install DUO Security with Ubuntu 16.04 LTS

2017-01-23T11:38:21+00:00 January 19th, 2017|Linux, Security, Ubuntu|

install ssh (if its not installed)- go to

cd /etc/apt/sources.list.d/

create file in /etc/apt/sources.list.d/

sudo nano duosecurity.list

edit file and add this

deb http://pkg.duosecurity.com/Ubuntu xenial main

exit and install curl

sudo apt-get install curl

download duosecurity key and add to system

curl -s https://duo.com/APT-GPG-KEY-DUO | sudo apt-key add –

update apt

sudo apt-get update

install duo-unix

sudo apt-get install duo-unix

add key’s to /etc/duo/pam_duo.conf (Integration, Secret, API hostname) from duo website

sudo nano /etc/duo/pam_duo.conf

edit common-auth

sudo nano /etc/pam.d/common-auth

add to file at the bottom /etc/pam.d/common-auth (make sure there are no duplicates)

auth requisite pam_unix.so nullok_secure
auth [success=1 default=ignore] /lib64/security/pam_duo.so
auth requisite pam_deny.so
auth required pam_permit.so
auth optional pam_cap.so

edit /etc/ssh/sshd_config add

sudo nano /etc/ssh/sshd_config


ChallengeResponseAuthentication yes
UsePAM yes
UseDNS no

if use public key add

PubkeyAuthentication yes
PasswordAuthentication yes
AuthenticationMethods publickey,keyboard-interactive

need to make some changes in the pam.d/sshd config

sudo nano /etc/pam.d/sshd

You need to comment out and add the following lines

#@include common-auth
auth [success=1 default=ignore] /lib64/security/pam_duo.so
auth requisite pam_deny.so
auth required pam_permit.so
auth optional pam_cap.so

Load More Posts