A Logo

Feel free to include my content in your page via my
RSS feed

Help Irongeek.com pay for
bandwidth and research equipment:

Search Irongeek.com:

Affiliates:
Irongeek Button
Social-engineer-training Button

Help Irongeek.com pay for bandwidth and research equipment:

paypalpixle


Unix File Permissions and Ownership  (Hacking Illustrated Series InfoSec Tutorial Videos)

Unix File Permissions and Ownership (CHOWN, CHMOD, ETC)

I'm taking a security class were we had a lab on Unix/Linux file system permissions. I decided I might as well record it, and the steps taken, along with explanations as to what I was doing to set the permissions such as read, write, execute, SetUID, SetGID and the Stickybit. Kevin Benton created the lab, so I'd like to give him credit for inspiring me to do this video.

 

Download from:

http://www.archive.org/download/UnixFilePermissionsAndOwnership/UnixFilePermissionsAndOwnershipchownChmodEtc.wmv

Commands used:

Basic Setup:

sudo useradd alice
sudo useradd bob
sudo useradd mallory
sudo useradd chuck
sudo mkdir -p /opt/data/financing
sudo mkdir -p /opt/data/development/bob
sudo mkdir /opt/data/development/mallory
sudo mkdir /opt/data/development/public
sudo mkdir -p /opt/data/marketing/public
sudo mkdir /opt/data/shared
touch /opt/data/financing/costprojections.txt
touch /opt/data/development/bob/bobscode.txt
touch /opt/data/development/mallory/malloryscode.txt
touch /opt/data/development/public/publiccode.txt
touch /opt/data/marketing/strategy.txt
touch /opt/data/marketing/public/slogan.txt

Setting Ownership and Groups:

chown alice /opt/data
chown alice /opt/data/financing
chown alice /opt/data/shared
chown bob /opt/data/development
chown bob /opt/data/development/bob
chown -R mallory /opt/data/development/mallory
chown -R bob /opt/data/development/public
chown -R www-data:www-data /opt/data/development/public
chown -R chuck:chuck /opt/data/marketing
chown -R www-data:www-data /opt/data/marketing/public

Getting Started With Permissions:

chmod u=rwx,g=rx,o=rx /opt/data
chmod 0755 /opt/data
chmod u=rwx,g=,o= /opt/data/financing
chmod u=rx,g=,o= /opt/data/financing/costprojections.txt
chmod u=rwx,g=rx,o=rx /opt/data/development
chmod u=rwx,g=,o= /opt/data/development/mallory
chmod u=rwx,g=,o= /opt/data/development/bob
chmod u=rwx,g=,o= /opt/data/marketing
chmod u=rwx,g=rx,o= /opt/data/marketing/public
chmod u=rw,g=r,o= /opt/data/marketing/public/slogan.txt
chmod 777 /opt/data/shared

Stickybit, SetUID and SetGID:

chmod 1777 /opt/data/shared
chmod -t /opt/data/shared
chmod +t /opt/data/shared
chgrp www-data /opt/id
chown alice /opt/whoami
chmod u+s /opt/whoami
chmod g+s /opt/id

Links:
http://en.wikipedia.org/wiki/Filesystem_permissions

http://www.dartmouth.edu/~rc/help/faq/permissions.html
 
http://www.zzee.com/solutions/unix-permissions.shtml
 

Printable version of this article

15 most recent posts on Irongeek.com:


If you would like to republish one of the articles from this site on your webpage or print journal please contact IronGeek.

Copyright 2016, IronGeek
Louisville / Kentuckiana Information Security Enthusiast