linux chown example

3:55 PM in Linux, Programming by Vic Russell

chown

chown – change owner of file system resources on Linux/Unix systems

To change the owner of a file name ‘myfilename.jsp’, do the following:

sudo chown jamessmith myfilename.jsp

To change ownership AND group for All directories and files below the current working directory:

sudo chown -R jamessmith:wheel ./ .*

It IS a CAPITAL R ( – Recursive)  and there is a space between the ‘./’ and the ‘.*

NOTE: chown can be a very dangerous command – it cannot be undone.  Exercise caution when changing ownership on files/directories en mass without a more targeted wildcard (e.g. “chown  meuser:mygroup *.jsp” will change ownership of only .jsp files in the present working directory – these are NOT system files and will not result in a system-wide error – though they may mess up your Java App server :( )