Configuring SELinux to allow the sharing of a directory by Samba

Tested on RHEL6/CentOS6.

As root:

# mkdir /data
# ls -dZ /data
drwxr-xr-x. root root unconfined_u:object_r:default_t:s0 /data
# semanage fcontext -a -t samba_share_t ‘/data(/.*)?’
# restorecon -R /data
# ls -dZ /data
drwxr-xr-x. root root unconfined_u:object_r:samba_share_t:s0 /data

You may also want to run the following:
setsebool -P samba_export_all_rw 1

What is dm-0?

dm-0 and friends (dm-1, dm-2, etc) are devices used by Device Mapper when LVM is in use.

To see what LVM volume each one relates to, run the following command (all on one line).

sudo lvdisplay|awk '/LV Name/{n=$3} /Block device/{d=$3; sub(".*:","dm-",d); print d,n;}'

Source: http://superuser.com/questions/131519/what-is-this-dm-0-device

Using the find command to find files older than a specific date

Some times you need to find all the files older than a particular date. You could us a number of programming languages to do the job or two simple Bash commands.

Lets say you want to find all the files in your home directory from before 2012.

touch --date "2012-01-01" /tmp/2012-01-01.txt
find /home/username -type f -not -newer /tmp/2012-01-01.txt
rm /tmp/2012-01-01.txt

That’s it.

Note: This works with the GNU find shipped with Linux.  I haven’t checked other find versions.