Giter Club home page Giter Club logo

file-permissions's Introduction

File permissions

Description

In this scenario, we must examine and manage the permissions on the files in the /home/researcher2/projects directory for the researcher2 user. The researcher2 user is part of the research_team group. We must check the permissions for all files in the directory, including any hidden files, to make sure that permissions align with the authorization that should be given. When it doesn't, we must change the permissions.

Language Used

  • Bash

Environments Used

  • Linux

Program walk-through

Here’s how we’ll do this task: First, we’ll check the user and group permissions for all files in the projects directory. Next, we’ll check whether any files have incorrect permissions and change the permissions as needed. Finally, we’ll check the permissions of the /home/researcher2/projects/drafts directory and modify these permissions to remove any unauthorized access.

Check file and directory details

Commands for the following data will be (the result is enclosed):

  • cd projects (switch to the /home/researcher2/projects directory);
  • ls -la (reveals the content of current directory with the owner types of user, group, other with their rights to read/write/examine. In addition to that, the hidden file .project_x.txt is also disclosed:

Check file and directory details

Describe the permissions string

In the /home/researcher2/projects directory, there are five files with the following names and permissions:

project_k.txt

  • User = read, write
  • Group = read, write
  • Other = read, write

project_m.txt

  • User = read, write
  • Group = read
  • Other = none

project_r.txt

  • User = read, write
  • Group = read, write
  • Other = read

project_t.txt

  • User = read, write
  • Group = read, write
  • Other = read

.project_x.txt

  • User = read, write
  • Group = write
  • Other = none

There is also one subdirectory inside the projects directory named drafts. The permissions on drafts are:

  • User = read, write, execute
  • Group = execute
  • Other = none

Change file permissions

The organization does not allow other to have write access to any files. Permissions of the project_k.txt were changed (the owner type of other doesn’t have write permissions) - chmod o-w project_k.txt:

project_k.txt

  • User = read, write
  • Group = read, write
  • Other = read, write

Change file permissions on a hidden file

The research team has archived .project_x.txt, which is why it’s a hidden file. This file should not have write permissions for anyone, but the user and group should be able to read the file. We use a Linux command to assign .project_x.txt the appropriate authorization.

First, we check the changes to the permissions in the /home/researcher2/projects directory: ls -la. We change the permissions of the file .project_x.txt so that both the user and the group can read, but not write to, the file - chmod u-w,g-w,g+r .project_x.txt:

.project_x.txt

  • User = read, write
  • Group = write, ${\color{green}read}$
  • Other = none

Change directory permissions

The files and directories in the projects directory belong to the researcher2 user. Only researcher2 should be allowed to access the drafts directory and its contents. First, we check the permissions of /home/researcher2/projects/drafts directory: ls -l We remove the execute permission for the group and therefore has access to the drafts directory: chmod g-x drafts

The permissions on drafts are:

  • User = read, write, execute
  • Group = execute
  • Other = none

Summary

We showed practical experience in using basic Linux Bash shell commands to:

  • examine file and directory permissions
  • change permissions on files
  • change permissions on directories

file-permissions's People

Contributors

artemino1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.