Ravindra BagaleCourses & study guides मराठी

DevOps

Chapter 4: Linux Ops Refresh for DevOps

Friends, today we take a short Linux ops refresh — before the DevOps tools. If the app is down, is the process dead, is the port closed, or is the disk full? Paths, permissions, logs, systemd, df / ps / ss, SSH keys. Deep Linux and EC2 launch live in the AWS course — here we only build the daily ops muscle. Do not fear: few commands, big habit.

What you will learn in this chapter

  • Paths, permissions, log following
  • systemd start/enable vs service
  • Disk, process, listening ports
  • SSH keys, scp and rsync one-liners
  • When to open the AWS Linux chapters

Concepts in this chapter

  1. 4.1When the app is "down" — three checks
  2. 4.2Paths and permissions — enough to stay safe
  3. 4.3Logs — journalctl and tail -f
  4. 4.4systemd — start, enable, status
  5. 4.5Disk, process, ports — the triage trio
  6. 4.6SSH keys, scp, rsync — one-liners
  7. 4.7Worked triage story — peak traffic
  8. 4.8Quick extras — uptime, memory, who am I
  9. 4.9What this chapter deliberately skips

The chapter recap is at the end of the last concept page.

Practice Tasks

About this scenario

Suppose we are on the DevOps team at Airbnb, the travel stays company, working from San Francisco. Sophia Martinez leads the team, and we look after the host payout service. Costs are counted in USD. In the tasks below we do real DevOps jobs on this project using what this lesson teaches. Airbnb is a real company, but this project, the people, servers, IP addresses and numbers are made up for practice.

0 / 10

Easy Protect an SSH key file

Why: SSH refuses to use a key file that other users can read.

What to do: Make airbnb-key.pem readable only by its owner and nobody else (no write).

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Click Check answer.

Easy Set normal web file permissions

Why: Web files should be readable by everyone but writable only by the owner.

What to do: Give index.html the permissions: owner read+write, group read, others read (use numbers).

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Click Check answer.

Easy Check memory

Why: If RAM is full the server slows down or kills apps.

What to do: Show used and free memory in human-readable units.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Click Check answer.

Easy Create a team group

Why: Groups let you give the same access to many users at once.

What to do: Create a group named airbnb-dev.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Click Check answer.

Easy Set a user's password

Why: A new user cannot log in with a password until one is set.

What to do: Set the password for user sophia.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Click Check answer.

Easy Switch to another user

Why: Testing as the real user shows what they can and cannot do.

What to do: Switch to user sophia with a full login environment.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Click Check answer.

Medium Give a folder to the web server user

Why: If nginx does not own the upload folder, uploads fail with "permission denied".

What to do: Make user nginx and group nginx the owners of /var/www/airbnb/uploads and everything inside.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Click Check answer.

Medium Fix permissions on a whole folder

Why: Folders need the x bit so the web server can enter them. -R applies it to everything inside.

What to do: Set permissions 755 on /var/www/airbnb and everything inside it.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Click Check answer.

Medium Playbook: create a deploy user

Why: A dedicated user for deploys keeps root logins off.

What to do: Playbook for hosts all with become true. One task user: name sophia, groups docker, append true, shell /bin/bash.

How:
  1. Start from the top-level keys the task names.
  2. Indent child keys with 2 spaces (no tabs).
  3. Use "- " for list items and fill each value from the task.
  4. Check the colons and spacing, then click Check answer.

Hard Find big files

Why: When the disk is full, find large files first.

What to do: Find files bigger than 100 MB anywhere under /var.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Click Check answer.

Ravi Sir's Cards: 21 revision, interview and comparison cards for this chapter · मराठी cards