# Change file ownership to specified user id and restrict access to him. # Root user by default. This directory recursively by default. # Usage: own [USER] [FILES] function own() { local file="${2}" local user="${1}" # default to current dir. if [ "${file}" = "" ]; then file='.' fi # default to current user. if [ "${user}" = "" ]; then user="${UID}" fi # set ownership. chown "${user}":"${user}" -R "${file}" &> /dev/null # remove access from group and others. chmod -077 -R "${file}" }