Tag: debian

Debian

Mount encrypted LUKS usb disk at boot

Find USB Disk UUID sudo blkidsudo blkid or e.g. sudo blkid /dev/sdg1 | awk -F ‘"’ ‘{print $4}’sudo blkid /dev/sdg1 | awk -F ‘"’ ‘{print $4}’ Edit crypttab file sudo nano /etc/crypttabsudo nano /etc/crypttab and add a new line entry such as: UUID=<name> UUID=<disk_uuid> <mount_point> <type>UUID=<name> UUID=<disk_uuid> <mount_point> <type> Example: sdg5_crypt UUID=123456789-1234-1234-1234-1234567890ab none lukssdg5_crypt UUID=123456789-1234-1234-1234-1234567890ab …

Debian

Automated backups with rsync

Create a shell script nano /home/myusername/sync/backup_data.shnano /home/myusername/sync/backup_data.sh with the following contents: #!/bin/bash rsync -r -t -v –progress –delete -s /source/folder/ /destination/backup/folder/#!/bin/bash rsync -r -t -v –progress –delete -s /source/folder/ /destination/backup/folder/ Make the file executable chmod +x /home/myusername/sync/backup_data.shchmod +x /home/myusername/sync/backup_data.sh Test script ./backup_data.sh./backup_data.sh Edit crontab crontab -ecrontab -e Add a new line entry to run script …

Debian

Automatically mount usb drive at startup

Find USB Disk UUID sudo blkidsudo blkid or sudo blkid /dev/sdf1 | awk -F ‘"’ ‘{print $4}’sudo blkid /dev/sdf1 | awk -F ‘"’ ‘{print $4}’ Edit fstab file sudo nano /etc/fstabsudo nano /etc/fstab and add a new line entry such as: UUID=<disk_uuid> <mount point> <type> <options> <dump> <pass>UUID=<disk_uuid> <mount point> <type> <options> <dump> <pass> Example: …

Debian

Install the latest VirtualBox version on Debian

Add the repository to sources list sudo nano /etc/apt/sources.listsudo nano /etc/apt/sources.list deb http://download.virtualbox.org/virtualbox/debian jessie contribdeb http://download.virtualbox.org/virtualbox/debian jessie contrib Add the public key https://www.virtualbox.org/download/oracle_vbox_2016.asc sudo apt-key add oracle_vbox_2016.ascsudo apt-key add oracle_vbox_2016.asc or wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add – Update and Install sudo apt-get updatesudo apt-get …

Debian, OpenVPN

Debian – connect to a VPN at startup

Edit openvpn default configuration sudo nano /etc/default/openvpnsudo nano /etc/default/openvpn Uncomment AUTOSTART=”all” or Uncomment and edit the option AUTOSTART=”myhome” to auto-start only one vpn connection. Copy your configuration sudo cp /home/user/myhome.conf /etc/openvpn/myhome.confsudo cp /home/user/myhome.conf /etc/openvpn/myhome.conf Don’t forget to change paths inside /etc/openvpn/myhome.conf file for certificate, key etc.. Reload sudo systemctl daemon-reloadsudo systemctl daemon-reload Restart Openvpn sudo …

Debian

How to setup SSH keys

Create RSA Key Pair ssh-keygen -t rsassh-keygen -t rsa Create .ssh folder mkdir ~/.sshmkdir ~/.ssh Set right permissions chmod 700 ~/.sshchmod 700 ~/.ssh Create authorized_keys file touch ~/.ssh/authorized_keystouch ~/.ssh/authorized_keys Set right permissions chmod 600 ~/.ssh/authorized_keyschmod 600 ~/.ssh/authorized_keys Add public key to the authorized_keys cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keyscat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

Debian

How to mount Windows share on Debian

Install mount.cifs mount.cifs mounts a Linux CIFS filesystem. It is usually invoked indirectly by the mount command when using the “-t cifs” option. This command only works in Linux, and the kernel must support the cifs filesystem. The CIFS protocol is the successor to the SMB protocol and is supported by most Windows servers and …

Debian

Hardening SSH on Debian

Open a terminal Open file /etc/ssh/sshd_config sudo nano /etc/ssh/sshd_configsudo nano /etc/ssh/sshd_config Change the listen port Port 65002Port 65002 Deny root Login PermitRootLogin noPermitRootLogin no Make sure that users with empty passwords are not allowed to login to the system PermitEmptyPasswords noPermitEmptyPasswords no Allow certain users to have access via ssh AllowUsers user1 user2AllowUsers user1 user2 …