Prevent CONNMAN messing with interfaces

Find in /etc/connman/main.conf the line which has the following: NetworkInterfaceBlacklist = … If it’s hashed (#) remove the # and put in there the interfaces that you DON’T WANT connman to manage, like for example: NetworkInterfaceBlacklist = …, enp3s1 Restart the networking service or reboot the machine

SAMBA configuration

Server Side Create operating system user accounts as per your requirements useradd -g … -d … -m -s … -k … username Create shares on the server, e.g. /mnt/Disk2/shareA /srv/samba/share3 Modify the /etc/samba/smb.conf according to your specifications Add samba users with smbpasswd or pdbedit smbpasswd -a username pdbedit -a -u username Modify permissions on the shares to match your requirements  

Barrier server – client configuration

Server: alpha Server configuration / command: barriers –name alpha –enable-crypto –address :24800 some distributions instead of the command barriers they use the command barrier.server Client: bravo Client configuration / command: barrierc –enable-crypto alpha:24800 some distributions instead of the command barrierc they use the command barrier.client  

Older Distributions Repositories – Debian

As root, edit /etc/apt/sources.list and change the ftp.debian.org entries to archive.debian.org, as follows: deb http://archive.debian.org/debian/ <name> main non-free contrib deb-src http://archive.debian.org/debian/ <name> main non-free contrib deb http://archive.debian.org/debian-security/ <name>/updates main non-free contrib deb-src http://archive.debian.org/debian-security/ <name>/updates main non-free contrib Note that you need to substitute <name> with the codename of the distribution you are interested in As root, run: apt-get install debian-archive-keyring and once done, again as root run: apt-get update and you’re ready for doing any installs / upgrades to your system.

Implement .xsessionrc on Raspbian

A script within /etc/X11/Xsession.d called 75source-profile causes any changes to the $PATH made inside $HOME/.xsessionrc to be lost, as it reads $HOME/.profile after the $PATH is altered. The correct way to deal with this is to rename  or copy the 40×11-common_xsessionrc to a file with higher serial number that will run after the 75, for instance 80×11-common_xsessionrc and implement any changes to the $PATH within $HOME/.xsessionrc, thus: for UBIN in $HOME/bin $HOME/.local/bin; do { [ -d “$UBIN” ] && export PATH=$UBIN:$PATH }; done This will ensure that if any of the directories $HOME/bin and $HOME/.local/bin exist will be appended in the beginning of the $PATH Furthermore, to avoid duplication of those directories in the $PATH, it is necessary to edit $HOME/.profile and comment out the section that reads: # set PATH so it includes user’s private bin directories if [ -d “$HOME/bin” ]; then   PATH=$HOME/bin:$PATH fi Like this: # set PATH so it includes user’s private bin directories #if [ -d “$HOME/bin” ]; then #  PATH=$HOME/bin:$PATH #fi Finally, edit $HOME/.bashrc and add the following at the end: for UBIN in $HOME/bin $HOME/.local/bin; do { [[ -d $UBIN ]] \ && [[ ! $PATH =~ $UBIN ]] \ && PATH=$binDir:$PATH }; done That’s it! Congratulations, now you

Continue readingImplement .xsessionrc on Raspbian

AUTO_INCREMENT tricks

Say, on a mysql database, there’s a table example_table that contains a field example_id of type auto_increment and for some reason, one wants the next value of the auto_increment to be a specific value (x ≥ 0), then, they can do the following in a mysql session: alter table example_table auto_increment x; If the above table is not void of data and the current value of the auto_increment is y, one can run the above code, for any x > y only, otherwise an error is produced. NOTE, if a table has been emptied with the truncate statement, then the auto_increment is reset to the value 1.  

Encrypt Files / Directories

Say we have a directory myStuff in our $HOME and we want to encrypt it and use it to store sensitive information. Run: encfs $HOME/myStuff $HOME/myEncryptedStuff This will prompt you to answer few questions for the encryption. The directory myEncryptedStuff will be used as mount point to the encrypted directory myStuff To unmount the encrypted directory, run: fusermount -u $HOME/myEncryptedStuff To remount it, run: encfs $HOME/myStuff $HOME/myEncryptedStuff To change password for the encryption, have the directory unmounted and run: encfsctl passwd $HOME/myStuff

Metric vs Binary Multipliers

Metric (Decimal) prefixes 1 KB (KiloByte) = 1000 Bytes 1 MB (MegaByte) = 1000 KB or 1,000,000 Bytes 1 GB (GigaByte) = 1000 MB or 1,000,000 KB or 1,000,000,000 Bytes 1 TB (TeraByte) = 1000 GB or 1,000,000 MB or 1,000,000,000 KB or 1,000,000,000,000 Bytes Binary prefixes 1 KiB (KibiByte) = 1024 Bytes 1 MiB (MebiByte) = 1024 KiB or 1,048,576 Bytes 1 GiB (GibiByte) = 1024 MiB or 1,048,576 KiB or 1,073,741,824 Bytes 1 TiB (TebiByte) = 1024 GiB or 1,048,576 MiB or 1,073,741,824 KiB or 1,099,511,627,776 Bytes