Linux Security Debian Slax Tiny Core Health

Linux

If a Computer Won't Start from a CD, DVD or USB Drive

Filesystems

Partitioning

Live CDs for Partitioning

Grub

Master Boot Record

Root Terminal

Root File Manager

Root Text Editor

File Ownership

File Permissions

List the Contents of a Directory

Change Directory

Mount a Drive or Partition

Mount an ISO Image Without Writing it to a CD or DVD

Download Large Files

Other Commands

Dial Up Modems

Linux Links


Other Links


Contact Details

Linux

File Ownership

When using a Linux filesystem, every file and directory belongs to an owner and group.

Files and directories created by users, normally belong to them.

Operating system files and directories normally belong to root.


Security

Having File Ownership and Permissions, increases the security of Linux operating systems. Files cannot be modified without appropriate permissions. Unauthorized access is more difficult. Linux is less likely to be affected by viruses and malware. When malware does affect Linux, it is less invasive.


Change Owner

There may be times when you want to change the owner of files or directories. For example, you may copy files from a USB drive using the root file manager, and they may belong to root. You may want to change this, so they belong to you.


Root File Manager

With most Linux distributions, the owner and group can be changed using the Root File Manager. To do this, right click on a file or directory. Click "Properties," then click "Permissions."


Root Terminal

Following is how to change owner and group using the Root Terminal.


Find Out Owner and Group

To find out the owner and group, open the terminal and type:

ls -l

ls stands for list, and -l stands for long.


Change Owner and Group

The owner and group can be changed using the "chown" (change owner) command. You normally need to use the Root Terminal.

chown options include:

chown [option] [owner][:[group]] file [more files]

The options within square brackets are optional. You must always include "chown," and you must always include the name of the file. You can use the name of the owner, or the group, or both. The group must be preceeded by a ":" to distinguish it from the owner. If you use a ":" not followed by a group name, it will be changed to the group of the user logged in.


Some Examples

If you were in the directory /home/hilary/, and you wanted to change the owner of the file pictures/holiday/beach.jpg, to hilary, you could use:

chown hilary pictures/holiday/beach.jpg

Another option is to change to that directory, then change the owner.

cd pictures/holiday
chown hilary beach.jpg

For more information see Change Directory.

If you wanted to change the owner to hilary, and the group to staff, you could use:

chown hilary:staff pictures/holiday/beach.jpg

If Hilary was logged in, and she wanted to change the owner to hilary, and the group to her group, she could use:

chown hilary: pictures/holiday/beach.jpg

The Recursive Option

The recursive option enables you to change the owner of a directory, and all files and directories within that directory, with one command. To do this use "-R."

For example, if you wanted to change the owner of the directory pictures, and all files and directories within pictures, to hilary, you could use:

chown -R hilary pictures

More Information

For more information and other options, open the terminal and type:

man chown

for the manual, or

chown --help

for help.


< Root Text Editor

File Permissions >


© Copyright Guy Shipard 2008 - 2009