Ubuntu settings

This article contains mainly the useful stuff I found in the Internet, but there are some things which I developed myself. This is my cheat-sheet, in order not to search the web again. If it turns out to be useful for somebody else, I will only be glad. These settings were made for Ubuntu 20.04 LTS.

Here’s the previous version for Ubuntu 16.04 LTS: Ubuntu16_settings.txt
Here’s the previous version for Ubuntu 18.04 LTS: Ubuntu18_settings.txt

((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
======================================== Initial setup ===============================

#=================== Simple GUI adjustments ==========================
- Desktop backround solid color
- remove unneccessary icons from the launcher
- Dock icon size = 32
- Language Support + Regional Formats
- keyboard repeat delay: Settings > Universal Access > Typing > Repeat keys
- Keyboard shortcuts: Ctrl-Shift-Esc = gnome-system-monitor
- Mount NTFS volumes
- Nautilus Bookmarks: drag and drop
- Shortcuts on desktop
- login to Firefox

#========================== Make Linux use 'Local' time ==========================
timedatectl set-local-rtc 1

#================ Set the grub timeout and the grub default boot entry ===========

sudo gedit /etc/default/grub
sudo update-grub


====================================== Mount NTFS partition in fstab =======================

sudo mkdir /media/d1
sudo mkdir /media/d2
sudo mkdir /media/cloud
sudo blkid
sudo gedit /etc/fstab

UUID=1185b49e-0551-42c5-8510-3149f2964b8a none            swap    sw              0       0
UUID=6f5d0096-211f-4e9b-8a32-ba242fa86017 /media/cloud auto nosuid,nodev,nofail,x-gvfs-show 0 0
tmpfs /tmp tmpfs defaults,noatime,nosuid,nodev,mode=1777,size=16384M 0 0
UUID=7020AE1B20ADE874 /media/d1 ntfs-3g permissions,windows_names,locale=en_US.utf8 0 0
UUID=00C0C2ECC0C2E6CE /media/d2 ntfs-3g permissions,windows_names,locale=en_US.utf8 0 0

sudo mount -a


============================ /tmp directory in RAM ===================
sudo gedit /etc/fstab

tmpfs /tmp tmpfs defaults,noatime,nosuid,nodev,mode=1777,size=8192M 0 0

#=================== Disable Gnome animation =========================

sudo apt install gnome-tweak-tool

1. General > Animations = Off


============ Laptop goes to sleep with lid closed before login and after logout ===============
Gnome Tweaks > General > Suspend when laptop lid is closed

OR

sudo gedit /etc/systemd/logind.conf

Search for these lines and make them look like this (possibly by removing # in front or replacing suspend with ignore):

HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore

=============== Double Commander ======================

Install Snap version from Ubuntu software

# check if it is still needed in Ubuntu 20
sudo apt install libssh2-1

OR

sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/Alexx2000/xUbuntu_18.04/ /' > /etc/apt/sources.list.d/home:Alexx2000.list"
wget -nv https://download.opensuse.org/repositories/home:Alexx2000/xUbuntu_18.04/Release.key -O Release.key
sudo apt-key add - < Release.key
sudo apt update
sudo apt install doublecmd-gtk
sudo apt install libssh2-1

Configuration > Options > File views > Sorting directorie = sort like files and show first
Configuration > Options > File views > Formatting > * format = B
Configuration > Options > Fonts-Main font, Path font
Configuration > Options > Icons -- 16x16
Configuration > Options > Layout -- Show toolbar = off, Show function key buttons = off

Configuration > Options > Keys > Hot keys > cm_LeftOpenDrives = Alt-1 and cm_RightOpenDrives = Alt-2 (because Alt-F1 and Alt-F2 are taken by Gnome)

Configuration > Options > Behaviors > Drive black list:
/home/ssh-ate/*;/run/user/1000/gvfs;/media/drew/Win;*telegram-desktop.mnt;/run/snapd/ns*;/home/guests/Inbox-d2;/home/guests/video;/home/drew/.cache/doc;/run/user/1000/doc;/var/lib/docker*;/run/docker*;*gmail.com;/run/vmblock-fuse;*1005/doc;*@gmail.com*


====================== Unrar in Double Commander ===============

https://onformix.blogspot.com/2017/10/dc-libunrar.so.html
Download GTK2 portable version, unpack libunrar.so and put it to /lib

================ Install 7zip and rar ===========================================
sudo apt-get update
sudo apt-get install rar unrar

sudo apt-get install p7zip-rar p7zip-full

============== Cyrillic characters in Windows archives ================
sudo apt-add-repository ppa:hanipouspilot/file-roller
sudo apt-get install file-roller


===================== Enable Edit As Administrator =====================

sudo apt install nautilus-admin
sudo nautilus -q


=========== Install LibreOffice via PPA (snap version is slow) =======================

sudo add-apt-repository ppa:libreoffice/ppa
sudo apt-get install libreoffice

To uninstall:
	sudo apt-get install ppa-purge && sudo ppa-purge ppa:libreoffice/ppa

Link colors in LibreOffice Calc: Tools > Options > LibreOffice > Application Colors > Text Document > Field Shading

============== Install Thunderbird from PPA (snap version is old) ==============

sudo add-apt-repository ppa:mozillateam/ppa
sudo apt install thunderbird
sudo apt install xul-ext-lightning

To uninstall -- sudo apt-get install ppa-purge && sudo ppa-purge ppa:mozillateam/ppa

=====================================================

================== Google calendar to accept invitations in Thunderbird 60 ===================

- In Preferences > Advanced (Tab) > General (stealthy subtab) > Config Editor (Button)
- Search for "calendar.google.enableEmailInvitations" and ensure the property is set to true
- Go to the calendar you want to use with your email, right click it and select "Properties"
- Change the "Email" field to the account you want to process invites for
- Click "OK"
- Go to an email invitation and you should now see the accept and decline buttons.


#==================== Install Notepadqq ==================

sudo snap install --classic notepadqq
Then allow access to removable storage devices in Ubuntu software > notepadqq > Permissions

=========================================== User groups ==================================
sudo addgroup GROUP

sudo adduser USERNAME GROUP

groups USERNAME


================================= Share folder for Windows ===============================
sudo apt-get install samba

sudo useradd user2
sudo smbpasswd -a user2

sudo gedit /etc/hostname

sudo gedit /etc/samba/smb.conf
[global]
usershare owner only = false

workgroup = ATE

and add to the end of the file:
[User2]
path = /media/d1/User2
available = yes
valid users = user2
read only = no
browsable = yes
public = yes
writable = yes

[Pics]
path = /media/d1/Pics
available = yes
valid users = user2
read only = no
browsable = yes
public = yes
writable = yes


path = /media/d2/video
available = yes
valid users = user2
read only = no
browsable = yes
public = yes
writable = yes


sudo gedit /etc/security/limits.conf
add to the end:
* - nofile 16384
root - nofile 16384

sudo service smbd restart

================================ Mount Windows Share =======================

https://ubuntuforums.org/showthread.php?t=2078120

sudo apt-get install cifs-utils

sudo mkdir /media/drew/drew-pc-d
sudo mkdir /media/drew/drew-pc-e

sudo gedit ~/.smbcredentials
username=msusername
password=mspassword

sudo chmod 600 ~/.smbcredentials

sudo gedit /etc/fstab

//drew-pc/d /media/drew_d cifs credentials=/home/drew/.smbcredentials,uid=1000,iocharset=utf8 0 0
//drew-pc/e /media/drew_e cifs credentials=/home/drew/.smbcredentials,uid=1000,iocharset=utf8 0 0

sudo mount -a


=================== Install Skype (snap version is old) =================================================
cd ~/Downloads
wget https://go.skype.com/skypeforlinux-64.deb
sudo dpkg -i skypeforlinux-64.deb
rm skypeforlinux-64.deb

If Skype doesn't save the password:
    In the Ubuntu launch menu, type password to find the utility Passwords and Keys. Open this utility.
    In the panel on the left you should see an entry Login in the section Passwords. Right click on Login, and select Change Password from the pop-up menu.
    You'll need to enter your current password first, then it asks for a new password
    Just leave the fields blank and press Continue.


=================== Install Viber (problem with libssl1.1) -- calls not working! =================================================

cd ~/Downloads
wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.3_amd64.deb
sudo dpkg -i libssl1.0.0_1.0.2n-1ubuntu5.3_amd64.deb
rm libssl1.0.0_1.0.2n-1ubuntu5.3_amd64.deb

wget http://download.cdn.viber.com/cdn/desktop/Linux/viber.deb
sudo dpkg -i viber.deb
rm viber.deb

For Startup -- /opt/viber/Viber

============== Install Telegram =============

sudo snap install telegram-desktop


================ Start Chrome with a certain profile ================

google-chrome --profile-directory=Default
google-chrome --profile-directory="Profile 1"


========================== Install Virtualbox 6.1.6 ===================

Install from Ubuntu software
OR
sudo apt install virtualbox

cd ~/Downloads
wget https://download.virtualbox.org/virtualbox/6.1.6/Oracle_VM_VirtualBox_Extension_Pack-6.1.6.vbox-extpack
sudo virtualbox Oracle_VM_VirtualBox_Extension_Pack-6.1.6.vbox-extpack
rm Oracle_VM_VirtualBox_Extension_Pack-6.1.6.vbox-extpack

sudo adduser $USER vboxusers


For Secure boot (together with VMware):
cd /home/drew/.ssh
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=drew/"
sudo su
/usr/src/linux-headers-`uname -r`/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxdrv)
/usr/src/linux-headers-`uname -r`/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vmmon)
/usr/src/linux-headers-`uname -r`/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vmnet)
mokutil --import MOK.der

Use BIOS pass for mokutil. Then reboot your machine and follow the instructions to complete the enrollment from the UEFI console. Check the enrollment:
sudo mokutil --test-key MOK.der

More details at:
https://gist.github.com/gabrieljcs/68939c7eeadfabfdbc6b40100130270d
https://askubuntu.com/questions/760671/could-not-load-vboxdrv-after-upgrade-to-ubuntu-16-04-and-i-want-to-keep-secur
https://kb.vmware.com/s/article/2146460


==================== VMware Workstation Player ========================

cd ~/Downloads
https://www.vmware.com/go/getplayer-linux
wget https://download3.vmware.com/software/player/file/VMware-Player-15.5.2-15785246.x86_64.bundle
sudo bash VMware-Player-15.5.2-15785246.x86_64.bundle
rm VMware-Player-15.5.2-15785246.x86_64.bundle

sudo gedit /etc/vmware/config
	prefvmx.minVmMemPct = "100"

If secure boot is enabled -- see above for Virtualbox
     
=================== Install Teamviewer =============================


sudo apt-get install libqt5x11extras5 qtdeclarative5-controls-plugin qtdeclarative5-dialogs-plugin
sudo apt-get -f install

cd ~/Downloads
wget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb
sudo dpkg -i ~/Downloads/teamviewer_amd64.deb
rm teamviewer_amd64.deb

--------Login screen locked ----------------
sudo gedit /etc/gdm3/custom.conf
	WaylandEnable=false


============= Desktop shortcuts ============

gedit ~/Desktop/Chrome-home.desktop

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=/usr/bin/google-chrome --profile-directory=Default
Name=Chrome home
Comment=Chrome home
Icon=/opt/google/chrome/product_logo_256.png


gedit ~/Desktop/Chrome-work.desktop

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=/usr/bin/google-chrome --profile-directory="Profile 1"
Name=Chrome work
Comment=Chrome work
Icon=/opt/google/chrome/product_logo_256.png


Then allow execution in properties.


=============== Change display resolution ==============
xrandr --output HDMI-1 --mode 1920x1200
xrandr --output HDMI-1 --mode 1920x1080
xrandr --output HDMI-1 --mode 1280x960


======================= Slow start of Unison and some other software ===================

sudo apt install appmenu-gtk2-module appmenu-gtk3-module
reboot 



============== Sync folders -- Unison ==============

https://unix.stackexchange.com/questions/583058/unison-and-version-compiler-conflicts/583377#583377

Build the latest version from source (apt still contains old version with bugs):
Afterwards, check that /usr/bin/unison is not the same size as /usr/bin/unison-gtk2

==Without GUI==
cd ~/Downloads
sudo apt install ocaml-native-compilers
wget https://github.com/bcpierce00/unison/archive/master.zip
unzip master.zip
cd unison-master/
sudo make all && make test && sudo HOME=/usr make install
cd ..
rm -rf unison-master
rm master.zip

# save text version of the program in case it is overwritten by GTK2 version
#cp /usr/bin/unison .
====

==With GUI==
sudo apt install ocaml-native-compilers
sudo apt install libgtk2.0-dev liblablgtk2-ocaml liblablgtk-extras-ocaml-dev libcanberra-gtk-module
cd ~/Downloads
wget https://github.com/bcpierce00/unison/archive/master.zip
unzip master.zip
cd unison-master/
sudo make all && make test && sudo HOME=/usr make install
sudo cp ./src/unison /usr/bin/unison-gtk2
cd ..
rm -rf unison-master
rm master.zip
#cp ./unison /usr/bin/unison

sudo apt remove ocaml-nox -y
sudo apt autoremove -y
sudo apt clean

====

Profiles stored at /home/drew/.unison/*.prf

common.prf
# Helps out a lot on Windows
fastcheck = true

# place new files at the top of the list
sortnewfirst = true

# turn on ssh compression
rshargs = -C

# Do not sync permissions
dontchmod = true
perms = 0

ignore = Name Thumbs.db
ignore = Name *~
ignore = Name *.tmp
ignore = Name _SYNCAPP
ignore = Name metadata.xml


unison profilename -batch

========= Dropbox =================
Install from website:
https://www.dropbox.com/install-linux


================== Configure cron scheduled tasks ===========
touch ~/cronjobs.txt
gedit ~/cronjobs.txt
50 19 * * * unison d2Backup_ArchiveProjects -batch -dontchmod -perms 0
0 20 * * * unison d2Backup_Work -batch -dontchmod -perms 0
30 20 * * 5 sh ~/archive-work.sh

touch ~/archive-work.sh
gedit ~/archive-work.sh
#!/bin/sh
7z a -pPASSWORD /media/d2/Inbox-d2/Backup/Work-$(date +%Y-%m-%d).7z /media/d1/Work > archive-work.log

Make it hidden and executable:
chmod 700 ~/archive-work.sh

crontab -u drew ~/cronjobs.txt
crontab -l

grep CRON /var/log/syslog



============ Install OpenSSH =================
https://www.digitalocean.com/community/tutorials/how-to-enable-sftp-without-shell-access-on-ubuntu-16-04
https://en.wikibooks.org/wiki/OpenSSH/Cookbook/File_Transfer_with_SFTP#SFTP-only_Accounts

sudo apt install openssh-server

sudo mkdir -p /home/ssh-grp
sudo chown drew:grp /home/ssh-grp
sudo chgrp grp /home/ssh-grp

sudo mkdir -p /home/ssh-grp/ftp-dir1
sudo mkdir -p /home/ssh-grp/ftp-dir2

sudo chown root /home/ssh-grp


sudo gedit /etc/fstab
/media/d1/FTP/dir1 /home/ssh-grp/ftp-dir1 none bind
/media/d1/FTP/dir2 /home/ssh-grp/ftp-dir2 none bind



sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.factory-defaults
sudo gedit /etc/ssh/sshd_config

Port NNN
PermitRootLogin no
Subsystem sftp internal-sftp


#add to the end:

Match user drew
ChrootDirectory /media
ForceCommand internal-sftp
PasswordAuthentication yes
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no

Match Group grp
ChrootDirectory /home/ssh-grp
ForceCommand internal-sftp
PasswordAuthentication yes
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no




tail -f /var/log/auth.log

sudo systemctl restart ssh


================= Hide users ===============

printf "[User]\nSystemAccount=true" | sudo tee /var/lib/AccountsService/users/albina > /dev/null



=========== Firewall =============
https://www.digitalocean.com/community/tutorials/how-to-setup-a-firewall-with-ufw-on-an-ubuntu-and-debian-cloud-server

sudo apt-get install ufw
sudo ufw status
sudo ufw app list
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 11111/tcp
sudo ufw deny OpenSSH
sudo ufw allow Samba
sudo ufw deny CUPS
sudo ufw enable
sudo ufw status


=========== File permissions =======
http://manpages.ubuntu.com/manpages/xenial/en/man8/ntfs-3g.8.html
Ownership and Permissions
========================== Install Pulse Secure Client =================== cd ~/Downloads wget http://trial.pulsesecure.net/clients/ps-pulse-linux-9.1r4.0-b143-ubuntu-debian-64-bit-installer.deb sudo dpkg -i ps-pulse-linux-9.1r4.0-b143-ubuntu-debian-64-bit-installer.deb cd /usr/local/pulse/ sudo sed -i "s/UBUNTU_VER\ \=\ 18\ \]/& \|\|\ [\ \$UBUNTU_VER\ \=\ 20 \]/" PulseClient_x86_64.sh sudo ./PulseClient_x86_64.sh install_dependency_packages sudo mkdir /usr/local/pulse/extra sudo mkdir /usr/local/pulse/debs cd /usr/local/pulse/debs sudo wget http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu60_60.2-3ubuntu3_amd64.deb sudo wget http://archive.ubuntu.com/ubuntu/pool/universe/w/webkitgtk/libjavascriptcoregtk-1.0-0_2.4.11-3ubuntu3_amd64.deb sudo wget http://archive.ubuntu.com/ubuntu/pool/universe/w/webkitgtk/libwebkitgtk-1.0-0_2.4.11-3ubuntu3_amd64.deb #sudo wget https://launchpad.net/ubuntu/+source/webkitgtk/2.4.11-4/+build/14964670/+files/libwebkitgtk-1.0-0_2.4.11-4_amd64.deb cd /usr/local/pulse/extra sudo dpkg -x /usr/local/pulse/debs/libicu60_60.2-3ubuntu3_amd64.deb . sudo dpkg -x /usr/local/pulse/debs/libjavascriptcoregtk-1.0-0_2.4.11-3ubuntu3_amd64.deb . sudo dpkg -x /usr/local/pulse/debs/libwebkitgtk-1.0-0_2.4.11-3ubuntu3_amd64.deb . #sudo dpkg -x /usr/local/pulse/debs/libwebkitgtk-1.0-0_2.4.11-4_amd64.deb . export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/pulse/extra/usr/lib/x86_64-linux-gnu/ sudo apt-get install libenchant-dev #Modify the desktop shortcut: Exec=/usr/bin/env LD_LIBRARY_PATH=/usr/local/pulse/extra/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH /usr/local/pulse/pulseUi More details at: https://askubuntu.com/questions/1135065/cant-run-pulse-secure-on-ubuntu-19-04-because-libwebkitgtk-1-0-so-0-is-missing https://medium.com/@yildirimabdrhm/pulse-secure-client-installation-on-linux-8bc524088793 ============ Disable Pidgin notifications =============== Ctrl-U -- Libnotify Popups -- Configure plugin ==================== Resize images in Nautilus ========================== sudo apt-get update sudo apt-get install imagemagick -y sudo apt install nautilus-image-converter nautilus -q ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ============= Separate output audio devices for each app ============================ sudo apt-get install pavucontrol pavucontrol ========================== Fix "Failed to activate service 'org.bluez': timed out" error ============== sudo systemctl enable bluetooth.service OR sudo apt-get remove pavucontrol ========================== Fix "Cannot access vdagent virtio channel /dev/virtio-ports/com.redhat.spice.0" error ============== sudo apt purge spice-vdagent ============================= Fix "Couldn't get size: 0x800000000000000e" error ====================================== In BIOS : Security -> Secure Boot -> Secure Boot Mode -> [Standard] ================== Windows software ================ - Dropbox -- from www.dropbox.com - Draftsight (http://dl-ak.solidworks.com/nonsecure/draftsight/2018SP1/draftSight.deb) - text editor: notepadqq (regular expressions not working), Geany, SciTE - File manager -- Double Commander - FTP server -- OpenSSH - video player -- VLC (Ubuntu software or sudo snap install vlc) - ultraISO -- UNetbootin + sudo apt-get install isomaster - photo manager -- digikam (alternatives: gThumb, KPhotoAlbum, Darktable, F-Spot, GTKRawGallery, Picty, Fotoxx) - ebook converter -- Calibre - audio capture -- Audio Recorder - audio editor -- Audacity - video capture (Screen recorder) -- Open Broadcaster Software (OBS) - video convert -- Handbrake (Selene?) - Video Editor -- Kdenlive - PDF Reader -- Evince - PDF Editor -- ============== Ready desktop shortcuts for all applications =================== /usr/share/applications/ /var/lib/snapd/desktop/applications ============== Open As in Double Commander =================== ~/.local/share/applications ======== Merge several mp3 files ================ sudo apt-get install mp3wrap mp3wrap output.mp3 *.mp3 ================= Install Docker from Ubuntu repo (the version from Docker repo is superfluous) ======================= sudo apt-get update sudo apt-get remove docker docker-engine docker.io docker-ce docker-ce-cli containerd.io sudo apt install docker.io docker-compose sudo groupadd docker sudo usermod -aG docker $USER newgrp docker sudo systemctl start docker sudo systemctl enable docker docker --version =================== Docker PXE Server =================== https://github.com/ferrarimarco/docker-pxe OR https://hub.docker.com/r/linuxserver/netbootxyz -- depends on external DHCP server, e.g. in OpenWRT: Network -> DHCP and DNS -> TFTP Settings -> Network boot image: netboot.xyz.kpxe,,192.168.1.2 netboot.xyz.efi,,192.168.1.2 mkdir /media/d1/Dist/OS/netbootxyz/win sudo mount -o loop /media/d1/Dist/OS/Windows10_orig/WIN10_64_En.ISO /media/d1/Dist/OS/netbootxyz/win sudo umount /media/d1/Dist/OS/netbootxyz/win Shift+F10 wpeinit net use S: \\192.168.1.2\dist /user:guest password S:\os\netbootxyz\win\sources\setup.exe ===================== Reset keyring password ==================== sudo rm ~/.local/share/keyrings/login.keyring ============ htaccess for downloadbox ================== AddType application/octet-stream .zip .gz Order Deny,Allow Allow from All RewriteEngine Off ================= Migrate website to new domain ==================== mysqldump -u USERNAME -p -h localhost DBNAME > db.sql sed -i 's/OLD.SITE.COM/NEW.SITE.COM/g' db.sql mysql -u USERNAME -p DBNAME < db.sql rm db.sql find /home/www/ -type f -exec \ sed -i 's/OLD\.SITE\.COM/NEW.SITE.COM/g' {} + ========================= Make clonezilla live USB ===================== Format a USB flash stick into FAT32 and label it CZILLA-USB cd ~/Downloads wget https://dotsrc.dl.osdn.net/osdn/clonezilla/71822/clonezilla-live-2.6.4-10-amd64.zip # wget https://dotsrc.dl.osdn.net/osdn/clonezilla/72474/clonezilla-live-2.6.5-21-i686.zip unzip clonezilla-live-2.6.4-10-amd64.zip -d /media/drew/CZILLA-USB rm clonezilla-live-2.6.4-10-amd64.zip sudo bash /media/drew/CZILLA-USB/utils/linux/makeboot.sh /dev/sdd4 ============================ Clonezilla -- make and restore partition image in batch/unattended mode ===================== For EFI boot mode: add the following text to grub.cfg file, which is located in /boot/grub directory on your live USB or CD. The text should be added before this line: menuentry "Clonezilla live (Default settings, VGA 800x600)"{ ((((((((((( Example for host OS -- one partition only menuentry "Make partition image unattended from sda3 to /dev/sdb1/Backup/HDD-Images/drew-pc/Ubuntu18/01-basic"{ search --set -f /live/vmlinuz linux /live/vmlinuz boot=live config noswap nolocales edd=on nomodeset noprompt ocs_prerun="mount /dev/sdb1 /mnt" ocs_prerun1="mount --bind /mnt/Backup/HDD-Images/drew-pc/Ubuntu18 /home/partimag/" ocs_live_run="ocs-sr -q2 -c -j2 -z1p -i 4096 -sfsck -scs -senc --batch -p reboot saveparts 01-basic sda3" ocs_live_extra_param="" ocs_live_keymap="NONE" keyboard-layouts=NONE ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=788 ip=frommedia nosplash ocs_numlk=on initrd /live/initrd.img } menuentry "Restore partition image unattended from /dev/sdb1/Backup/HDD-Images/drew-pc/Ubuntu18/02-mainsoft to sda3"{ search --set -f /live/vmlinuz linux /live/vmlinuz boot=live config noswap nolocales edd=on nomodeset noprompt ocs_prerun="mount /dev/sdb1 /mnt" ocs_prerun1="mount --bind /mnt/Backup/HDD-Images/drew-pc/Ubuntu18 /home/partimag/" ocs_live_run="ocs-sr -g auto -e1 auto -e2 -r -j2 -k --batch -p reboot restoreparts 02-mainsoft sda3" ocs_live_extra_param="" ocs_live_keymap="NONE" keyboard-layouts=NONE keyboard-layouts=NONE ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=788 ip=frommedia nosplash ocs_numlk=on initrd /live/initrd.img } )))))))))))) For legacy boot mode: add the following text to isolinux.cfg (loading from ISO image) or syslinux.cfg (loading from USB-flash stick) file, which is located in /syslinux directory on your live USB or CD. The text should be added after this line: MENU TITLE clonezilla.org, clonezilla.nchc.org.tw ((((((((((( Example for VirtualBox (shrinking VDI file size) -- whole disk label Clonezilla sda to sdb1-DiskImage MENU LABEL Make disk image unattended from sda to /dev/sdb1/DiskImage kernel /live/vmlinuz append initrd=/live/initrd.img boot=live config noswap nolocales edd=on nomodeset noprompt ocs_prerun="mount /dev/sdb1 /mnt" ocs_prerun1="mount --bind /mnt /home/partimag/" ocs_live_run="ocs-sr -q2 -j2 -z1p -i 4096 -sfsck -scs -senc --batch -p reboot savedisk DiskImage sda" ocs_live_extra_param="" ocs_live_keymap="NONE" keyboard-layouts=NONE ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=788 ip=frommedia nosplash ocs_numlk=on TEXT HELP * Please check your params beforehand -- no more confirmations! ENDTEXT label Clonezilla sdb1-DiskImage to sda MENU LABEL Restore disk image unattended from /dev/sdb1/DiskImage to sda kernel /live/vmlinuz append initrd=/live/initrd.img boot=live config noswap nolocales edd=on nomodeset noprompt ocs_prerun="mount /dev/sdb1 /mnt" ocs_prerun1="mount --bind /mnt /home/partimag/" ocs_live_run="ocs-sr -g auto -e1 auto -e2 -r -j2 --batch -p reboot restoredisk DiskImage sda" ocs_live_extra_param="" ocs_live_keymap="NONE" keyboard-layouts=NONE keyboard-layouts=NONE ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=788 ip=frommedia nosplash ocs_numlk=on TEXT HELP * Please check your params beforehand -- no more confirmations! ENDTEXT )))))))))))) Then replace the following parameters with your values in al places: sda3 -- imaged partition 03-all -- image name /dev/sdb1 -- drive that will store the image Backup/HDD-Images/drew-pc -- path on the drive that will store the image sda -- imaged drive When restoring the image with just one partition, first copy these files from the complete image: sda1.vfat-ptcl-img.gz.aa swappt-sda4.info ==================== Install and use partclone in Ubuntu Live USB =========================== #!/bin/sh sudo echo 'deb http://cz.archive.ubuntu.com/ubuntu bionic main universe' > /etc/apt/sources.list.d/partclone.list sudo apt-get update sudo apt-get install partclone sudo mkdir /media/d1 sudo mount /dev/sdb1 /media/d1 sudo partclone.ext4 -N -c -s /dev/sda3 | gzip -c > /media/d1/Backup/HDD-Images/win10_last.gz sudo mkdir /media/d1 sudo mount /dev/sdb1 /media/d1 sudo gzip -c -d /media/d1/Backup/HDD-Images/win10_last.gz | partclone.ext4 -N -r -o /dev/sda3 ==================================== Edit ISO including bootable ones ============================== sudo apt-get install isomaster OR https://poweriso.com/download-poweriso-for-linux.htm ======================= Create ramdisk and start Digikam with its DB on ramdisk -- but better make /tmp in RAM ==================== sudo mkdir /mnt/ramdisk /opt/digikam/start_with_ramdisk.sh : pkexec mount -t tmpfs -o rw,size=512M tmpfs /mnt/ramdisk cp -r -f /home/drew/Documents/digikam_db /mnt/ramdisk sh /opt/digikam/AppRun cp -r -f /mnt/ramdisk/digikam_db /home/drew/Documents #pkexec umount /mnt/ramdisk #the ramdisk will be unmounted after the next reboot ==================== Export OpenWRT router config =============== ssh root@192.168.1.1 "uci export" > router.conf #============================= Disable password prompt in sudo (convenient but not secure -- do not forget to change it back!) ============================== #1. sudo visudo #Change: %sudo ALL=(ALL:ALL) ALL #to %sudo ALL=(ALL) NOPASSWD:ALL #2. sudo nano /etc/polkit-1/localauthority/50-local.d/99-nopassword.pkla [No password prompt] Identity=unix-group:sudo Action=* ResultActive=yes ========================== Install openjdk 8 ========================== sudo apt remove openjdk* sudo apt purge openjdk* sudo apt install openjdk-8-jdk openjdk-8-source sudo update-java-alternatives --set java-1.8.0-openjdk-amd64 export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:jre/bin/java::") ========================== Install openjxf 8 ========================== sudo apt-mark unhold openjfx libopenjfx-jni libopenjfx-java sudo apt remove openjfx sudo apt purge openjfx sudo apt update sudo apt install openjfx=8u161-b12-1ubuntu2 libopenjfx-jni=8u161-b12-1ubuntu2 libopenjfx-java=8u161-b12-1ubuntu2 sudo apt-mark hold openjfx libopenjfx-jni libopenjfx-java Then add /usr/share/java as global library in Project Structure ========================== Install openjdk 11 ========================== sudo apt install openjdk-11-jdk openjdk-11-source sudo update-java-alternatives --set java-1.11.0-openjdk-amd64 export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:jre/bin/java::") ========================== Install openjxf 11 ========================== sudo apt install openjfx export PATH_TO_FX=/usr/share/openjfx/lib export CLASSPATH=$CLASSPATH:/usr/share/java/openjfx/lib/ ========================== Java enabled browser ========================== palemoon ===================== Install Handbrake ============= sudo add-apt-repository ppa:stebbins/handbrake-releases sudo apt-get update sudo apt-get install handbrake-gtk sudo apt-get install handbrake-cli #for video passthrough use MKVToolNix ===================== Install MKVToolNix ============= wget -q -O - https://mkvtoolnix.download/gpg-pub-moritzbunkus.txt | sudo apt-key add - sudo sh -c "echo 'deb https://mkvtoolnix.download/ubuntu/ bionic main\ndeb-src https://mkvtoolnix.download/ubuntu/ bionic main' > /etc/apt/sources.list.d/mkvtoolnix.download.list" sudo apt update sudo apt install mkvtoolnix mkvtoolnix-gui ==================== Install Selene =========== sudo apt-add-repository -y ppa:teejee2008/ppa sudo apt-get update sudo apt-get install selene =============== Install DraftSight ====================== cd ~/Downloads wget http://dl-ak.solidworks.com/nonsecure/draftsight/2019SP1/draftSight.deb sudo dpkg -i ~/Downloads/draftSight.deb ================ Install Audacity ================ Use Ubuntu Software -- may display error sudo add-apt-repository ppa:ubuntuhandbook1/audacity sudo apt-get update sudo apt-get install audacity ============== Install Calibre ==================== sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.py | sudo python -c "import sys; main=lambda:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main()" ====================== Install Audio Recorder =============== sudo add-apt-repository ppa:audio-recorder/ppa sudo apt-get -y update sudo apt-get install --reinstall audio-recorder ========== Install digikam -- /tmp should be in RAM =============== #!/usr/bin/env xdg-open [Desktop Entry] Version=1.0 Type=Application Terminal=false Icon[en_US]=gnome-panel-launcher Name[en_US]=Digikam Exec=sh /home/drew/digikam/start_with_ramdisk.sh Name=Digikam Icon=/home/drew/digikam/digikam.png == start_with_ramdisk.sh == #!/bin/bash cd ~/digikam if !(test -f "digikam-6.4.0-x86-64.appimage";) then wget https://download.kde.org/stable/digikam/6.4.0/digikam-6.4.0-x86-64.appimage chmod ug+x digikam-6.4.0-x86-64.appimage fi cp -r -f ~/digikam/digikam_db /tmp ~/digikam/digikam-6.4.0-x86-64.appimage cp -r -f /tmp/digikam_db ~/digikam rm -r -f /tmp/digikam_db ==== ================== Install RDP ================ https://askubuntu.com/questions/592537/can-i-access-ubuntu-from-windows-remotely sudo apt-get update sudo apt-get install xrdp sudo apt-get install xfce4 echo xfce4-session >~/.xsession sudo gedit /etc/xrdp/startwm.sh The content should look like this (pay attention to the last line and ignore . /etc/X11/Xsession): " #!/bin/sh if [ -r /etc/default/locale ]; then . /etc/default/locale export LANG LANGUAGE fi startxfce4 " sudo service xrdp restart ==================================== Mount shares inside vbox ============================== https://gist.github.com/estorgio/1d679f962e8209f8a9232f7593683265 Install Guest Additions CD image... sudo apt-get update sudo apt-get install build-essential linux-headers-`uname -r` sudo /media/cdrom/./VBoxLinuxAdditions.run sudo shutdown -r now mkdir /home/andrew/vboxshare sudo mount -t vboxsf shared /home/drew/vboxshare sudo nano /etc/fstab shared /home/drew/vboxshare vboxsf defaults 0 0 sudo nano /etc/modules Add the following line to /etc/modules and save vboxsf shutdown -r now ================ Remote desktop via VNC =============== sudo apt update && sudo apt install -y vino vino-preferences gsettings set org.gnome.Vino require-encryption false #and forward port 5900 on the router ================= Install OpenVPN =============== sudo apt-get update sudo apt-get install openvpn sudo openvpn --config /media/d1/configfile.ovpn ========================== Make ISO image ================= mkisofs -allow-lowercase -allow-multidot -J -joliet-long -jcharset utf-8 -o /media/d1/Pics/My_photo/Archive/2017.iso /media/d1/Pics/My_photo/2017 ================ Download an offline website mirror, make and mount ISO image =============== sudo apt-get install webhttrack bash process_after_httrack.sh sudo mkdir /media/drew/iso sudo mount -o loop /media/d1/Stasia/offline-websites/doctorberezovska_com_2018-02-25.iso /media/drew/iso sudo umount /media/drew/iso -----------process_after_httrack.sh--------- #!/bin/bash source_path=/media/d2/Temp/HTTrack project_name=doctorberezovska_com temp_path=/media/d1/Temp iso_path=/media/d1/Stasia/offline-websites url_prefix=http:/ pagename=index.html basepath=$temp_path/$project_name cp -r $source_path/$project_name $temp_path rm -rf $basepath/hts-cache #delete all folders "feed" find $basepath -type d -name feed -exec rm -r {} \; #delete all files index????.html find $basepath -type f -name index????.html -exec rm -r {} \; find $basepath -type f -name index.html -size 0c > empty_indexes.txt #download empty index.html files while read -ru 3 LINE; do #replace basepath with http prefix in each line urlpath=${LINE/$basepath/$url_prefix} #delete index.html in each line urlpath=${urlpath/$pagename} wget -k --output-document="$LINE" $urlpath done 3< empty_indexes.txt find $basepath -type f -name *.html > all_html.txt while read -ru 3 LINE; do #Replace http://doctorberezovska.com/ with ../ #Some links are not replaced by HTTrack. This replacement will only work for level 1 pages, but they are the majority. A universal replacement is too complicated. #Also delete trash after sed -i 's_http://doctorberezovska.com/_../_g;/<\/html>/q' $LINE done 3< all_html.txt grep Error: $basepath/hts-log.txt >errors.txt rm -rf $basepath/hts-log.txt mkisofs -r -iso-level 4 -o $iso_path/$project_name"_"$(date +%Y-%m-%d).iso $basepath rm -rf $basepath ---------------------------------------------- ========================== Burn ISO e.g. ================ sudo fdisk -l sudo umount /dev/sdd sudo dd bs=4M if=/media/d1/Dist/Util/Hdd-tools/WinPE10_8_Sergei_Strelec/WinPE10_Sergei_Strelec_x64_2018.01.05_English_lite.iso of=/dev/sdd status=progress oflag=sync OR if bootable USB flash sudo add-apt-repository ppa:gezakovacs/ppa sudo apt-get update sudo apt-get install unetbootin sudo QT_X11_NO_MITSHM=1 /usr/bin/unetbootin ====================== SVN and Git GUI client ================= sudo add-apt-repository ppa:rabbitvcs/ppa sudo apt-get update sudo apt-get install rabbitvcs-cli rabbitvcs-core rabbitvcs-gedit rabbitvcs-nautilus rabbitvcs-nautilus3 sudo apt-get remove rabbitvcs* OR RapidSVN in UbuntuSoftware rep ========== Download Youtube video ======== Find youtube-dl in Ubuntu software OR sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl sudo chmod a+rx /usr/local/bin/youtube-dl =============== On input source change the scroll lock toggles ======================= sudo gedit /etc/default/keyboard XKBOPTIONS="grp:alt_shift_toggle,grp_led:scroll" #XKBOPTIONS="grp:alt_shift_toggle" gsettings reset org.gnome.desktop.input-sources xkb-options ========================= Batch resize images recursively ================================= sudo apt-get install build-essential checkinstall && apt-get build-dep imagemagick -y cd ~/Downloads wget https://www.imagemagick.org/download/ImageMagick.tar.gz tar xf ImageMagick.tar.gz cd ImageMagick-7* ./configure make sudo make install sudo ldconfig /usr/local/lib find . -name '*.jpg' -execdir mogrify -resize 1920x1440 {} \; find . -name '*.JPG' -execdir mogrify -resize 1920x1440 {} \; find . -name "*.jpg" | xargs mogrify -resize 50% find . -name "*.JPG" | xargs mogrify -resize 50% find . -name '*.png' -execdir mogrify -format jpg {} \; find . -name '*.PNG' -execdir mogrify -format jpg {} \; ========== Disable MySQL from startup ========= sudo /etc/init.d/mysql stop sudo systemctl disable mysql sudo systemctl enable mysql sudo /etc/init.d/mysql start =============== Rename all .MP3 to .mp3 files =========== sudo apt install rename rename 's/.MP3$/.xxx/' *.MP3 rename 's/.xxx$/.mp3/' *.xxx ============ Randomize (shuffle) all .mp3 files ================= for f in *.mp3 *.MP3; do mv "$f" $RANDOM.mp3; done ==================== Batch rename files in text editor ================= sudo apt install renameutils qmv ======================= Install WireGuard on Raspbian ================== sudo apt update && sudo apt upgrade -y sudo apt-get install raspberrypi-kernel-headers echo "deb http://deb.debian.org/debian/ unstable main" | sudo tee --append /etc/apt/sources.list.d/unstable.list wget -O - https://ftp-master.debian.org/keys/archive-key-$(lsb_release -sr).asc | sudo apt-key add - printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' | sudo tee --append /etc/apt/preferences.d/limit-unstable sudo apt update sudo apt install wireguard -y which wg which wg-quick ===================== Simple commands of Wireguard for two comps ====================== ============ Peer1 -- acting as server =========== umask 077 mkdir /home/USER1/wgkeys cd /home/USER1/wgkeys wg genkey | tee privatekey | wg pubkey > publickey cat /home/USER1/wgkeys/publickey sudo ip link add dev wg0 type wireguard sudo ip address add dev wg0 192.168.3.1 peer 192.168.3.2 sudo wg set wg0 listen-port 11111 private-key /home/USER1/wgkeys/privatekey peer PEER2_PUBLIC_KEY allowed-ips 192.168.3.0/24 persistent-keepalive 25 sudo ip link set wg0 up sudo wg ============ Peer2 -- acting as client =========== umask 077 mkdir /home/USER2/wgkeys cd /home/USER2/wgkeys wg genkey | tee privatekey | wg pubkey > publickey cat /home/USER2/wgkeys/publickey sudo ip link add dev wg0 type wireguard sudo ip address add dev wg0 192.168.3.2 peer 192.168.3.1 sudo wg set wg0 private-key /home/USER2/wgkeys/privatekey peer PEER1_PUBLIC_KEY allowed-ips 192.168.3.0/24 endpoint PEER1_DOMAIN_OR_IP:11111 persistent-keepalive 25 sudo ip link set wg0 up sudo wg ===================== Simple config of Wireguard for two comps -- persistent after reboot ====================== ============ Peer1 -- acting as server =========== umask 077 mkdir /home/USER1/wgkeys cd /home/USER1/wgkeys wg genkey | tee privatekey | wg pubkey > publickey cat /home/USER1/wgkeys/privatekey cat /home/USER1/wgkeys/publickey sudo vim /etc/wireguard/wg0.conf """"" [Interface] Address = 192.168.3.1 ListenPort = 11111 PrivateKey = PEER1_PRIVATE_KEY [Peer] PublicKey = PEER2_PUBLIC_KEY AllowedIPs = 192.168.3.0/24 PersistentKeepalive = 25 """"" sudo wg-quick up wg0 sudo systemctl enable wg-quick@wg0 sudo wg ping 192.168.3.2 ============ Peer2 -- acting as client =========== umask 077 mkdir /home/USER2/wgkeys cd /home/USER2/wgkeys wg genkey | tee privatekey | wg pubkey > publickey cat /home/USER2/keys/privatekey cat /home/USER2/keys/publickey sudo vim /etc/wireguard/wg0.conf """"" [Interface] Address = 192.168.3.2 PrivateKey = PEER2_PRIVATE_KEY [Peer] PublicKey = PEER1_PUBLIC_KEY AllowedIPs = 192.168.3.0/24 Endpoint = PEER1_DOMAIN_OR_IP:11111 PersistentKeepalive = 25 """"" sudo wg-quick up wg0 sudo systemctl enable wg-quick@wg0 sudo wg ping 192.168.3.1 ================================ Clean up ========== sudo apt autoremove sudo apt clean sudo journalctl --vacuum-time=1sh dm dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge sudo rm -rfv /var/lib/snapd/cache sudo mkdir /var/lib/snapd/cache sudo sh delete_old_snaps.sh #!/bin/bash # Removes old revisions of snaps # CLOSE ALL SNAPS BEFORE RUNNING THIS set -eu snap list --all | awk '/disabled/{print $1, $3}' | while read snapname revision; do snap remove "$snapname" --revision="$revision" done

3 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *