Start United States USA — software How to Use Linux File Permissions and Ownership on Alibaba Cloud ECS

How to Use Linux File Permissions and Ownership on Alibaba Cloud ECS

287
0
TEILEN

To prevent certain users from accessing certain parts of your Linux-based application, use this tutorial to learn to set and track user permissions.
Let’s be friends:
Everything ain’t for everybody. Take a look at how to manage and set user permissions in Linux here.
Comment (0)
Join the DZone community and get the full member experience.
Elastic Compute Service (ECS) is an innovative cloud computing product offered by Alibaba Cloud for running web, email and database servers. ECS makes virtual servers affordable and easier to manage than expensive physical machines. This is due to their flexible billing options and a wide array of features available for system administrators.
Alibaba Cloud has an easy-to-use console that allows you to provision an ECS of your choice with the right Operating System (OS), latest CPUs, fast RAM and solid state drives(SSD). To deploy a Virtual Cloud Server with Alibaba Cloud, you can choose Linux because it is the most popular OS that is built with stability and security in mind.
Linux has a robust file system suitable for high-performance servers that support a multi-user environment for running websites and applications.
In this guide, we will take you through the process of understanding Linux file permissions and ownership so that you can regulate the level of interaction that users have with files and directories.
Most Linux distributions (e.g. Ubuntu, Centos, and Fedora) create a group with the same name when a new user is provisioned on the system.
By default, files and directories are owned by the user who created them on the Linux system. For instance, if the user ‚james‘ creates a directory named test1, then, the ownership will be assigned to him.
To demonstrate this, SSH to your Alibaba ECS instance and create a directory named test1 using the command below:
To list the permissions and ownership of the directory, run the command below:
In Linux, ls is a command that lists files on the standard output. When used with the -l flag, it lists files and directories in a long format including as many details as shown below:
As you can see above, the folder test1 is owned by user ‚james‘ and a group with the same name.
There are three types of owner-based groups/communities in a Linux system:
A user is a person who currently has an account on a Linux machine. Like in our case above, ‚james‘ is a system user who currently owns ‚test1‘ directory.
A group is a collection of users. In Linux, you can create a group to organize users and make administration easier. For instance, if you are working on a project that requires a certain directory to be accessed by multiple users, you can add all the users to a single group for simplicity. Then, you can assign the right permissions to the shared directory.
Apart from users and groups that have access to a file or a directory, all other persons that can access it are regarded as „others.“ In most cases, this means everybody else.
This is where Linux file permissions come in to prevent unauthorized users from accessing files/directories.

Continue reading...