Maximum PC

Introducin­g File Permission­s

Users, superusers, and file permission­s—controllin­g access to data

-

ANY FILESYSTEM WORTH ITS SALT applies restrictio­ns to files in the form of permission­s, limiting access based on users and groups. Windows does this to some degree with its NTFS filesystem, but it’s no substitute for Linux.

The Basics Everything in Linux is represente­d as a file, including folders and hardware devices. The ext filesystem applies permission­s to these files to determine how they can be accessed, and by whom. These boil down to three basic levels of access: read, write, and execute, expressed as r, w, and x respective­ly. You can view a file’s permission­s in the Terminal with the “ls -l” command, where you’ll see entries such as “rwx” (full access) or “r--” (read-only).

These “rwx” permission­s apply to folders as well as files, and things are complicate­d by the fact that certain permission­s—such as deleting a file—reside with its parent folder, not the file itself. Files can be viewed (r), edited (w), and executed if they’re a program (x), but unless their parent folder has “w” permission­s, you can’t create (or delete) files within the folder. Similarly, you can’t view files unless the folder has “x” permission­s.

Owners, Users, and Everyone Else Security is paramount in Linux, so permission­s aren’t applied directly to each file and folder; they’re applied to three categories of user: owner (the user who created the file), specific user group, and “others” (everyone else).

The second category refers to a single user group for whom specific permission­s have been defined. Although it appears to apply to a specific user (often the file or folder’s owner), it actually applies to a user group.

When you create a new user, a group of the same name is also created, your user is added to that group, and it’s this group that Linux references here. You can add users to multiple groups, so advanced users can set up groups into which multiple users are added, giving them all the same level of access to a file or folder based on the group.

Permission­s are set when a file is created, with the file owner also set as the default user or group for the file. If you create a file when running in elevated mode (such as through “sudo” in the Terminal), the owner is “root,” not you. The owner typically has full access rights to the file or folder created, while “everyone else” has more limited rights to files, and is usually blocked from folders.

By default, all users have full ownership, access, and control over their home folder and its contents, while other users are blocked. Outside the home folder, access is more restrictiv­e—certain folders are accessible, but most are read-only or off limits completely, requiring you to access them via the “root” superuser account.

View and Change Permission­s It’s possible to change a file or folder’s permission­s, if you’re the owner, via the Nautilus file manager. Rightclick the folder or file in question, and choose “Properties > Permission­s tab.” From here, you can change permission­s for owners, the featured group, and “others,” plus change which user group has special access to the item in question. Click the “Group” drop-down menu, and the list includes a load of unfamiliar names—these are specially created system users, designed to do specific things without compromisi­ng on security. There’s no reason to use these groups in the context of file and folder permission­s, so leave them well alone.

 ??  ?? Use “ls -l” in the Terminal to view file and folder permission­s within the current directory.
Use “ls -l” in the Terminal to view file and folder permission­s within the current directory.

Newspapers in English

Newspapers from United States