Skip to content

Instantly share code, notes, and snippets.

View niclaslindstedt's full-sized avatar

Niclas Lindstedt niclaslindstedt

View GitHub Profile
@niclaslindstedt
niclaslindstedt / cifs_ubuntu.txt
Created October 17, 2018 06:46
Cifs on Ubuntu
# Install needed packages
sudo apt install cifs-utils
# Add a mount line to /etc/fstab
//<ip>/<share> <mount point> cifs credentials=<credentials file>,uid=<user id>,gid=<group id>,vers=2.0 0 0
@niclaslindstedt
niclaslindstedt / interfaces
Created October 17, 2018 05:42
Static ip in Linux
#/etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.100.101
netmask 255.255.255.0
network 192.168.100.0
broadcast 192.168.100.255
gateway 192.168.100.1
dns-nameservers 1.1.1.1 1.0.0.1
@niclaslindstedt
niclaslindstedt / sshd_config
Last active October 18, 2018 19:49
safe sshd configuration (add to bottom of config)
ClientAliveInterval 360
ClientAliveCountMax 0
PermitEmptyPasswords no
PermitRootLogin no
Protocol 2
Port 3089
PasswordAuthentication no
AuthenticationMethods publickey
PubkeyAuthentication yes
IgnoreRhosts yes
@niclaslindstedt
niclaslindstedt / resize-vbox-virtual-drive
Last active September 11, 2017 08:58
Resize virtual drive in VirtualBox
cd "C:\Program Files\Oracle\VirtualBox"
VBoxManage modifyhd <path to vdi image> --resize <new size in mb>
@niclaslindstedt
niclaslindstedt / block-non-vpn-traffic.sh
Last active August 14, 2017 07:25
Block all non-VPN traffic in iptables. Replace "192.168.100.0" with your home network.
#!/bin/sh
HOMENETWORK="192.168.100.0/24"
HOMENETIF="eth0"
HOMEVPNIF="tun0"
iptables --flush
# default policy
iptables -P INPUT DROP