How-to Set-Change Ownership on Files and Directories by the Command Line on Ubuntu 14.04 Trusty LTS LinuxOctober 15th, 2014 by thelinuxevangelist
Ubuntu Setting Ownerships for File/Directory
The Linux Tutorial Shows You Step-by-step How-to Setup or Change the Ownership over Files and Directories on Ubuntu 14.04 Trusty Tahr LTS Linux.
The Ownership Decide How is the Owner of Files and Directories on the Ubuntu Linux File System.
To Set the Ownership Over Files and Directories is the First Step in Setting Up Permissions and so Establish a Control and Security over the System.
To Follow the Tutorial You will Need to have a Little Practice to Work on the Ubuntu Linux Console Terminal Command Line.
Open Terminal Console Window
(Press “Enter” to Execute Commands)
Who Can Set/Change the Ownership?
Only the Administrators or a Super-User Can Change a File/Directory Ownership!
How to Set/Change the Ownership?
To Set/Change Ownership Over a Single File/Directory:
sudo su -c "chown [myUser]:[myGroup] [myEntity]"
Where [myUser] is your’s user Name & [myGroup] is your’s user Primary Group.
How-to Look Up User Name & Group on TerminalFind User Name & Group
mkdir -p $HOME/hello/world
Now to Give the ‘world’ Directory to the ‘root’ User do:
sudo su -c "chown root:root $HOME/hello/world"
ls -l $HOME/hello
To Set/Change Permissions Recursively Over a Directory and it’s Content (Subdirectories and Files):
sudo su -c "chown -R [myUser]:[myGroup] [myEntity]"
sudo su -c "touch $HOME/hello/world/happy"
ls -l $HOME/hello && ls -l $HOME/hello/world
Now to Get Back the ‘world’ Directory with the ‘happy’ File:)
sudo su -c "chown -R [myUser]:[myGroup] $HOME/hello/world"
Check again Ownership like Above…
How-to Set Permissions on Ubuntu File System:Ubuntu Permissions Quick-Start
How-to Quick-Start with Command Line on Ubuntu:
Tags: Bash, Command line, Console, Getting Started, linux command line, linux console, linux terminal, Linux Tutorial, Quick Start, Terminal, Tutorial, Ubuntu, ubuntu 14.04 Trusty Tahr LTS, ubuntu change ownership, ubuntu command line, ubuntu console, ubuntu directory ownership, ubuntu file ownership, ubuntu linux