Linux

gedit external tools fails to save documents

The bug is filed here: bugs.launchpad.net/ubuntu
/>source/gedit
bug/1244338

and here: bugzilla.gnome.org/…ow_bug.cgi

but if you can’t wait for the fix to come down from upstream, you can simply run this code as root:

Linux Backup solutions

Some resources for setting up backups:

Comparisons

Duplicity

Rsync

  • Main resources

Encrypted file systems

www.cyberciti.biz/hardware/howto-linux-hard-disk-encryption-with-luks-cryptsetup-command/ good how-to

  • Manually mounting (will be asked for pass phrase
cryptsetup luksOpen /dev/xvdo syncfs
mount /dev/mapper/syncfs /syncfs

www.linux.org/threads/rhel6-volume-encryption-using-luks.4219/ how to handly re-boot

dd if=/dev/random of=/root/syncfs.k bs=32 count=1
cryptsetup luksAddKey /dev/xvdo /root/syncfs.k
echo "syncfs /dev/xvdo /root/syncfs.k" > /etc/crypttab
  • Then add a line in /etc/fstab like:
/dev/mapper/syncfs /syncfs      ext4    defaults

Setting up permissions for bittorrent sync

The goal is to sync a common directory structure over multiple sites.

Permissions on server

  • create sync user:
useradd -g office -d /home/common -c "btsync service" -m btsync
  • Don’t use a sticky bit, or sync will not be able to delete files
  • Make sure all contributors to /home/common have primary group office and umask=002
    • This will mean that they all have read/write access to the common files
  • Recommended to use the SGID bit to lock all new files with group office and prevent this changing
chgrp -R office /home/common
chmod g+s /home/common #just to top directory (assume no sub-directories)
chmod -R g+w /home/common
  • Note that if a user creates a new file, when btsync replicates it on other systems it will lose ownership information (and be owned by btsync). But because it will have group office it will be editable.

First time setup

How To Migrate Linux Between Machines

There is an excellent article here: www.makeuseof.com/…en-machines

  • Create package list: dpkg --get-selections > ~/packagelist.txt
  • Mark packages for reinstallation on new system dpkg --set-selections < ~/packagelist.txt
    • This will mark all packages, but it won’t install them until you run:
  • apt-get -u dselect-upgrade

Bash Tips

vi ~/.bashrc #and find the first two occurrences of PS1 (color or not)
PS1='\A ${debian_chroot: #find line begining with PS1= and prepend \A as in this example
  • In RHEL

Gtk-WARNING **: Error loading icon: Couldn't recognize the image file format

Many GTK based apps failed with errors like:

Gtk-WARNING **: Error loading icon: Couldn't recognize the image file format for file '/usr/share/icons/oxygen/16x16/actions/application-exit.png'

until I ran this line to regenerate the cache:

gdk-pixbuf-query-loaders > /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache

Recover deleted files with Scalpel

This great tool enabled me to recover several hours of work.
I found it from this page: http://www.linuxforu.com/2011/09/recover-deleted-files-in-linux/
All you have to know is the first few bytes of the file and it searches the entire hard drive free space for blocks that begin with those bytes.

The find command

Syntax for find

find . -name "*.php" -exec echo {} \;

Using Screen

Syndicate content