comra.se

RPI setup

Initial setup of RPI. With keymap to remote from Kjell.com.


sudo dd if=path_of_your_image.img of=/dev/diskn bs=1m


$ fdisk -uc /dev/mmcblk0
Type ‘p’ to list all partitions, type ‘d’ and type the partition number to remove the Linux partition
Type ‘n’ to recreate the partition at same starting offset and a new length
Type ‘w’ to write the changes
Reboot
$ resize2fs /dev/mmcblk0p2

apt-get install kali-linux-wireless

// Autologin SSH
cat ~/.ssh/id_rsa.pub | ssh synology@IP_OF-RPI “mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys”

// WPA
root@xbian:/home/xbian# wpa_passphrase [ESSID] [password]
root@xbian:/home/xbian# cat /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="x"
psk=[psk set]
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}

root@xbian:/home/xbian# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
auto eth0

iface eth0 inet dhcp
iface lo inet loopback

allow-hotplug wlan0
iface wlan0 inet dhcp

iface default inet dhcp

# my wifi device
# auto wlan0
# iface wlan0 inet dhcp
iface wlan0 inet static
address 10.0.1.10
netmask 255.255.255.0
gateway 10.0.1.1
pre-up wpa_supplicant -B w -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
post-down killall -q wpa_supplicant

iface default inet dhcp


// FSTAB
root@xbian:/home/xbian# cat /etc/fstab
# UNCONFIGURED FSTAB FOR BASE SYSTEM
/dev/root /home xbian subvol=home/@,noatime,nobootwait 0 0
/dev/root /lib/modules xbian subvol=modules/@,noatime,nobootwait 0 0
/dev/root / xbian noatime,nobootwait 0 0
/dev/mmcblk0p1 /boot xbian rw,nobootwait 0 1
/dev/sda1 /external vfat defaults,uid=xbian,umask=000,gid=xbian,iocharset=utf8 0 0

none /run/user tmpfs noauto 0 0
none /run/shm tmpfs noauto 0 0
none /run/lock tmpfs noauto 0 0

// REMOTE
root@xbian:/home/xbian# cat /etc/init.d/keyremap
#!/bin/sh
setkeycodes 0x2 59
setkeycodes 0x32 60
setkeycodes 0x34 61
setkeycodes 0x33 62
setkeycodes 0x16 63
setkeycodes 0x35 64
# setkeycodes 0x20 65
setkeycodes 0x2f 66
# setkeycodes 0x1a 73
# setkeycodes 0x1d 75
setkeycodes 0x1e 57
#setkeycodes 0x1f 77
# setkeycodes 0x22 80
setkeycodes 0x18 16
setkeycodes 0x4 17
setkeycodes 0x31 18
setkeycodes 0x1c 19
# setkeycodes 0x9 20
# setkeycodes 0x8 21
setkeycodes 0x1b 22
setkeycodes 0xb 23
setkeycodes 0xc 24
setkeycodes 0x0 25
setkeycodes 0x21 26
setkeycodes 0x23 27
setkeycodes 0x27 30
setkeycodes 0x29 119
setkeycodes 0x28 31
setkeycodes 0x24 32
setkeycodes 0x25 33
setkeycodes 0x26 34
setkeycodes 0xd 2
setkeycodes 0xe 3
setkeycodes 0xf 4
setkeycodes 0x10 5
setkeycodes 0x11 6
setkeycodes 0x12 7
setkeycodes 0x13 8
setkeycodes 0x14 9
setkeycodes 0x15 10
setkeycodes 0x37 55
setkeycodes 0x17 11
setkeycodes 0x38 35
setkeycodes 0x30 36
# setkeycodes 0x36 28

root@skx:~# update-rc.d keyremap defaults

root@xbian:/home/xbian# cat .kodi/userdata/keymaps/keyboard.xml




ActivateWindow(shutdownmenu)
ActivateWindow(home)
ActivateWindow(settings)
ActivateWindow(Videos,videodb://movies/titles/)
ActivateWindow(Videos,sources://video/)
ActivateWindow(Videos,videodb://tvshows/titles/)

back
contextmenu
select
info
play
pause
stop
Select


UpdateLibrary(video)
noop
noop
BigStepBack
BigStepForward

Mute



StepBack
StepForward

VolumeUp
VolumeDown
PageUp
PageDown
noop
noop
noop




root@xbian:/home/xbian# adduser dan
root@xbian:/home/xbian# usermod -a -G sudo,xbian dan
root@xbian:/home/xbian# id dan
root@xbian:/home/xbian# smbpasswd -a dan

root@xbian:/home/xbian# visudo
dan ALL=(ALL) NOPASSWD: ALL längst ner

// SSH
Ta bort permit root login

// Samba
[content]
path = /external
guest ok = yes
read only = no
force user = xbian
browseable = yes
valid users = dan xbian