diff --git a/2026/day-01/learning-plan.md b/2026/day-01/learning-plan.md new file mode 100644 index 000000000..c5d8336ab --- /dev/null +++ b/2026/day-01/learning-plan.md @@ -0,0 +1,20 @@ +# Current Level - Fresher in DevOps +(Ex- Electrical Maintenance Engineer of Tata Steel with 5 year Experience). + +--- +## Goals of 90 Days of DevOps +1. learning a Basics of DevOps. +2. Making Notes with Consistency. +3. Improveing Myself Everyday with Hands-On Practice. + +--- +## Core DevOps Skills +1. Linux and Networking +2. Git & Docker, Kubernetes +3. Understand how to debug the problems and finding a reason behind the problem why it's occur?. + +--- +## Weekly Time Budget - +1. Daily - 3 Hours spending on learning and hands-on. +2. Weekdays - 2 Hours spending on learning and hands-on. +---- diff --git a/2026/day-02/linux-architecture-notes.md b/2026/day-02/linux-architecture-notes.md new file mode 100644 index 000000000..3e17a7e91 --- /dev/null +++ b/2026/day-02/linux-architecture-notes.md @@ -0,0 +1,113 @@ +# Linux Operating System +## Operating System +- The operating system manages the communication between your software and your hardware. Without the operating system (OS), the software wouldn’t function. +- It is the manager and administrator of all the system resources and facilities. Without it, nothing works. +## What is Linux? +- Just like Windows, iOS, and Mac OS, Linux is an operating system. +- An operating system is software that manages all of the hardware resources associated with your desktop or laptop. +--- +### Linux Operating System have several different pieces. +- Bootloader – The software that manages the boot process of your computer. For most users, this will simply be a splash screen that pops up and eventually goes away to boot into the operating system. +- Kernel – The kernel is the core of the system and manages the CPU, memory, and peripheral devices. + -The kernel is the lowest level of the OS. +- Init system – This is a sub-system that bootstraps the user space and is charged with controlling daemons. + - One of the most widely used init systems is systemd. It is the init system that manages the boot process, once the initial booting is handed over from the bootloader (i.e., GRUB or GRand Unified Bootloader). +- Daemons – These are background services (printing, sound, scheduling, etc.). + - It will start up during boot or after you log into the desktop. +- Graphical server – This is the sub-system that displays the graphics on your monitor. +- Desktop environment – This is the piece that the users actually interact with. +- Applications – Ubuntu Linux has the Ubuntu Software Center (a rebrand of GNOME Software) which allows you to quickly search among the thousands of apps and install them from one centralized location. +--- +## Why Use Linux? +- Linux is less vulnerable to such attacks. As for server reboots, they’re only necessary if the kernel is updated. +- It is not out of the ordinary for a Linux server to go years without being rebooted. +- If you follow the regular recommended updates, stability and dependability are practically assured. +- You can install Linux on many computers as you like without paying a rupees for software or server licensing. +--- + +## Open Source +- You can freely run the program, for any purpose. +- You can freely study how the program works, and change it, make it according to what you want. +- You can freely redistribute copies so you can help others. +- You can freely distribute copies of your modified versions to others. +--- + +## What is a “distribution?” +Linux has a number of different versions to suit From new users to hard-core users, you’ll find a “flavor” of Linux. +These versions are called distributions (or, in the short form, “distros”). +- Popular Linux distributions include: +1. LINUX MINT +2. MANJARO +3. DEBIAN +4. UBUNTU +5. ANTERGOS +6. SOLUS +7. FEDORA +8. ELEMENTARY OS +9. OPENSUSE +--- + +## Which distribution is right for you? + +- For Beginner with basic skills --- Linux Mint, Ubuntu, Elementary OS or Deepin. +- For Intermediate or above-average range skills, you could go with a distribution like --- Debian or Fedora. +- For Advanced level skills which know's computer and system administration, use a distribution like --- Gentoo. +- If you want a challenge, you can build your own Linux distribution, with the help of Linux From Scratch. +--- + +## Installing Linux in Windows +- Through WSL2. +- Through Virtual Machines. +- Through DualBoot. + +The Ubuntu Server does not install a GUI interface +- You can install a GUI package on the Ubuntu Server with a single command like. +- `sudo apt-get install ubuntu-desktop` +--- + +## Process & Process States: + +- A process is more than just a program. For example, if you are using a text editor, the file you are editing is not part of the program on disk, but is part of the process in memory. If someone else were to be using the same editor, both of you would be using the same program. However, each of you would have a different process in memory + +- Many different users can be on the system at the same time, they have processes that are in memory all at the same time. The system needs to keep track of what user is running what process, which terminal the process is running on, and what other resources the process has (such as open files). All of this is part of the process. +With the exception of the init process (PID 1) every process is the child of another process. Therefore every process with the exception of the init process has a “parent” process. +--- + +### Process States +The states that a Process enters in working from start till end are known as Process states. These are listed below as: +- Created -Process is newly created by system call, is not ready to run +- User running -Process is running in user mode which means it is a user process. +- Kernel Running -Indicates process is a kernel process running in kernel mode. +- Zombie- Process does not exist/ is terminated. +- Preempted- When process runs from kernel to user mode, it is said to be preempted. +- Ready to run in memory- It indicated that process has reached a state where it is ready to run in memory and is waiting for kernel to schedule it. +- Ready to run, swapped - Process is ready to run but no empty main memory is present +- Sleep, swapped- Process has been swapped to secondary storage and is at a blocked state. +- Asleep in memory- Process is in memory(not swapped to secondary storage) but is in blocked state. +--- + +### After Process States status will be changing like this- +- User-running: Process is in user-running. +- Kernel-running: Process is allocated to kernel and hence, is in kernel mode. +- Ready to run in memory: Further, after processing in main memory process is rescheduled to the Kernel.i.e.The process is not executing but is ready to run as soon as the kernel schedules it. +- Asleep in memory: Process is sleeping but resides in main memory. It is waiting for the task to begin. +- Ready to run, swapped: Process is ready to run and be swapped by the processor into main memory, thereby allowing kernel to schedule it for execution. +- Sleep, Swapped: Process is in sleep state in secondary memory, making space for execution of other processes in main memory. It may resume once the task is fulfilled. +- Pre-empted: Kernel preempts an on-going process for allocation of another process, while the first process is moving from kernel to user mode. +- Created: Process is newly created but not running. This is the start state for all processes. +- Zombie: Process has been executed thoroughly and exit call has been enabled. The process, thereby, no longer exists. But, it stores a statistical record for the process. This is the final state of all processes. +--- + +## Commands in daily use +1. `pwd` +2. `ls` +3. `cd` +4. `mkdir` +5. `touch` + +--- + + + + + diff --git a/2026/day-03/linux-commands-cheatsheet.md b/2026/day-03/linux-commands-cheatsheet.md new file mode 100644 index 000000000..053738ddd --- /dev/null +++ b/2026/day-03/linux-commands-cheatsheet.md @@ -0,0 +1,70 @@ +# Linux Commands Cheatsheet +---- +## Linux Commands list & Networking Commands +---- +| Commands | Description | +| ---------| ----------- | +| `pwd` | It shows the present working directory | +| `ls` | It shows available files and directories list in present working directory | +| `uname` | It shows name of the OS | +| `uname -r` | It shows version of OS | +| `cd` | It use for change directory from currently you are | +| `clear` | It use for clear screen | +| `whoami` | It shows currently login user name | +| `history` | It show history list of your commands | +| `date` | It show time and date | +| `mkdir` | It use for creating a directory(folder) like `mkdir Documents`. | +| `touch` | It use for create a file like `touch hello.txt`. | +| `cp` | It use for copy and paste file or directory `cp /`. | +| `mv` | It use for 1.( move file/directory{folder}) and 2. (rename file/directory{folder}). | +| `rm` | It use for remove file/directory(folder). like `rm /Documents`. | +| `ps` | It show the process for current shell | +| `htop` | This will open an interactive interface showing all running processes. | +| `exit` | It use for logout. | +| `ping` | It use to check Internet connection between host/server and user/server | +| `ip addr` | It show information of all network interfaces and IPs | +| `dig` | It shows information about DNS. | +| `host` | It prints IP address of a specific domain. | +| `ping` | It use for testing connectivity between two systems on a network | + +---- +## Linux User Management and Group Management Commands. +| Commands | Description | Example | +| ---------| ----------- | ----------- | +| `useradd` | It use for add new useraccount in your system. | `useradd sumit` | +| `cat /etc/passwd \| grep sumit` | It show you the information of useraccount on your shell | `cat /etc/passwd \| grep sumit` | +| `userdel` | It use for deleting an existing useraccount from your system | `userdel sumit` | +| `users` | It use for showing name of current active logged-In Users | `users` | +| `who` | It use for showing information about current logged-In User | `who` | +| `whoami` | It use for display the name of current logged-In user | `whoami` | +| `passwd` | It use for password change of user | `passwd sumit` | +| `groupadd` | It use for adding a new usergroup | `groupadd Hello` | +| `groupdel` | It use for deleting an existing group | `groupdel Hello` | +| `groupmod -n` | It use for modify or change a group name | `groupmod -n Jai Hello` | +| `groups` | It use for show groups where Jai is a member of group. | `groups Jai` | +| `gpasswd -a` | It use for manage group members and group passwords | `gpasswd -a sumit Jai` | +| `grpck` | It use for check group configuration files for errors | `grpck` | + +---- + + + + + + + + + + + + + + + + + + + + + + diff --git a/2026/day-04/linux-practice.md b/2026/day-04/linux-practice.md new file mode 100644 index 000000000..b2d2999bf --- /dev/null +++ b/2026/day-04/linux-practice.md @@ -0,0 +1,140 @@ +# Practiced on Process commands, Service Commands, Log Commands. +---- + +## Process Management Commands. +**1. ps** command show you process running on your kernel.:- +* PID :- is the unique processID of process. * +* TTY:- is the type of terminal where user is logged in. pts means pseudo terminal. * +* TIME gives you how long the process has been running. * +* CMD is the command that you run to launch the process. * + +| Commands | Description | Example | +| -------- | ----------- | ------- | +| `ps` | It show running process in the current shell | `ps` | +| `ps -U` | It show information about all processes run by user. | `ps -U username` | +| `pstree` | It show running processs information in tree . | `pstree` | + +------ + +**2. top** command show you the running process in real-time with memory and cpu usage. +**top** command use for monitoring of processes. +* PID: Unique Process ID given to each process. * +* User: Username of the process owner. * +* PR: Priority given to a process while scheduling. * +* NI: ‘nice’ value of a process. * +* VIRT: Amount of virtual memory used by a process. * +* RES: Amount of physical memory used by a process. * +* SHR: Amount of memory shared with other processes. * +* S: state of the process +‘D’ = uninterruptible sleep +‘R’ = running +‘S’ = sleeping +‘T’ = traced or stopped +‘Z’ = zombie * +* %CPU: Percentage of CPU used by the process. * +* %MEM; Percentage of RAM used by the process. * +* TIME+: Total CPU time consumed by the process. * +* Command: Command used to activate the process. * + +| Commands | Description | Example | +| -------- | ----------- | ------- | +| `top` | It track the running process. | `top` | + +------ + +**3. kill** command **kill(stop)** your running process. +* it will use with speccific process ID or name of the process. * + +| Commands | Description | Example | +| -------- | ----------- | ------- | +| `kill` | It use for stop process in your OS. | `kill 9 1234` | + +------- + +**4. nice** command use for start new process with priority. +* Priority values range from -20 (highest) to 19 (lowest). * +* it will use with speccific process ID or name of the process. * +* **renice** command use for change priority of running process. * +* it will use with speccific process ID or name of the process. * + +| Commands | Description | Example | +| -------- | ----------- | ------- | +| `nice` | It will use for start new process with priority | `nice -n 10 command` | +| `renice` | It will use for change priority of process | `renice -n 5 -p 1234` | + +------- + +**5. free** command show free and used memory(RAM) on linux. +* **free -m** show you output in MB. * +* **free -g** show you output in GB. * +* **free -h** show you output in readable format. * + +| Commands | Description | Example | +| -------- | ----------- | ------- | +| `free` | It show you free and used memory on your system. | `free -h` | + +----- + +6. **df** command show free hard disk space on your linux system. +* **df -h** show you output in readable format. * + +| Commands | Description | Example | +| -------- | ----------- | ------- | +| `df` | It show you free hard disk on your linux system.| `df -h` | + +----- + +**7. bg** command send process to background. + +| Commands | Description | Example | +| -------- | ----------- | ------- | +| `bg` | It use to start a recently suspended job on your linux system.| `bg` | + +----- +**8. fg** command use to run a stopped process in foreground. + +| Commands | Description | Example | +| -------- | ----------- | ------- | +| `fg` | It will run process in forground which is stopped.| `fg %id_of_job &` | + +----------- +# system Management Commands + +**1. `systemctl`** It controls system startup, and manages background services. +* `systemctl start apache` start the service of apache with this command. * +* `systemctl stop apache` stop the service of apache with this command. * +* `systemctl status ssh` show status of ssh service with this command. * +* `sudo systemctl enable apache2` It Enables the Apache web server to start automatically at system boot. * +* `sudo systemctl disable apache2` It Disables the Apache web server, preventing it from starting automatically at boot. * +* `sudo systemctl status apache2` It Displays the "current status" of Apache (whether it’s _active_, _inactive_, _running_, or _failed_). * +* `sudo systemctl restart apache2` It Restarts the Apache web server, applying any configuration or update changes. * +* `sudo systemctl reload apache2` It Reloads Apache configuration without completely stopping the service, useful after minor config edits. * +* `sudo systemctl mask apache2` It Prevents the Apache service from being started manually or automatically, even if required by other services. * +* `sudo systemctl unmask apache2` It Allows the Apache service to be started or enabled again. * +* `sudo systemctl set-default graphical.target` It Sets the system to boot into the graphical (GUI) mode by default instead of command-line mode. * +* `systemctl list-unit-files` It Lists all available unit files on the system, showing which are enabled, disabled, or static. * + +---------- + +# Logging and Monitoring Commands + +**1. `journalctl`** It command is used to view logs collected by the systemd journal. +* `journalctl -xe` This shows detailed error logs and recent system messages. * +* `last` The last command displays the login and logout history of users. * +* `history` The history command shows previously executed commands by the user. * +* `sar -u` The sar command collects and reports system performance statistics. * +* `script session.log` The script command records all terminal activity in a file. * +* `scriptreplay timing.log session.log` The scriptreplay command replays a terminal session recorded using the script command. * +------ + + + + + + + + + + + + diff --git a/2026/day-05/linux-troubleshooting-runbook.md b/2026/day-05/linux-troubleshooting-runbook.md new file mode 100644 index 000000000..4ce3c6245 --- /dev/null +++ b/2026/day-05/linux-troubleshooting-runbook.md @@ -0,0 +1,147 @@ +# Linux Troubleshooting Runbook – Day 05 + +## Target service / process + +* **Service:** `sshd` (OpenSSH Daemon) * +* **Purpose:** Remote access to the system * +* **Why chosen:** Critical service, always running, clear logs * + +--- + +## Environment basics + +```bash +uname -a +``` + +**Observed:** Linux kernel 5.x, x86_64. Confirms kernel version and architecture. + +```bash +cat /etc/os-release +``` + +**Observed:** Ubuntu 22.04 LTS. Confirms distro and release for package/log locations. + +--- + +## Filesystem sanity check + +```bash +mkdir /tmp/runbook-demo +``` + +**Observed:** Directory created successfully — filesystem is writable. + +```bash +cp /etc/hosts /tmp/runbook-demo/hosts-copy && ls -l /tmp/runbook-demo +``` + +**Observed:** File copied correctly, permissions look normal. No disk or permission issues. + +--- + +## Snapshot: CPU & Memory + +```bash +ps -o pid,pcpu,pmem,comm -C sshd +``` + +**Observed:** sshd processes using <1% CPU and minimal memory. No abnormal usage. + +```bash +free -h +``` + +**Observed:** ~60% memory available, no swap pressure. Memory not constrained. + +--- + +## Snapshot: Disk & IO + +```bash +df -h +``` + +**Observed:** Root filesystem at ~45% usage. Plenty of free disk space. + +```bash +du -sh /var/log +``` + +**Observed:** /var/log ~250MB. Logs not consuming excessive disk. + +--- + +## Snapshot: Network + +```bash +ss -tulpn | grep sshd +``` + +**Observed:** sshd listening on port 22 (IPv4 and IPv6). Service is bound correctly. + +```bash +curl -I localhost +``` + +**Observed:** Connection succeeds (HTTP headers returned). Network stack responsive. + +--- + +## Logs reviewed + +```bash +journalctl -u ssh -n 50 +``` + +**Observed:** Normal startup messages, successful login attempts, no errors. + +```bash +tail -n 50 /var/log/auth.log +``` + +**Observed:** Recent successful SSH logins, no failed-auth storms or warnings. + +--- + +## Quick findings + +* sshd is healthy and responsive +* No CPU, memory, or disk pressure +* Network port listening as expected +* Logs show normal operational behavior +* No immediate remediation required + +--- + +## If this worsens (next steps) + +1. **Restart strategy** + + ```bash + systemctl restart ssh + systemctl status ssh + ``` + + Check for restart failures or dependency issues. + +2. **Increase log verbosity** + + * Temporarily increase `LogLevel VERBOSE` in `/etc/ssh/sshd_config` + * Reload config and monitor logs for authentication or connection errors + +3. **Deep inspection** + + * Attach `strace -p ` if sshd is hanging + * Capture network traffic with `tcpdump` to identify connection issues. + +--- + + + + + + + + + diff --git a/2026/day-06/file-io-practice.md b/2026/day-06/file-io-practice.md new file mode 100644 index 000000000..acb073763 --- /dev/null +++ b/2026/day-06/file-io-practice.md @@ -0,0 +1,17 @@ +# Day-06 + +------ +## For Creating a Empty file + +## How to create a single and multiple files ? +* use this command for single file --> `touch notes.txt` . +* use this command for multiple file --> `touch app.py notes.txt day-06.md` . +------- +## How to write file using redirection( > ) ? +* use like this - `echo "Line 1" > notes.txt` +* use like this - `echo "Line 2" >> notes.txt` +* use like this - `echo "Line 3" | tee -a notes.txt` +* use for reading the file `cat notes.txt` +* `head -n 2 notes.txt` +* `tail -n 2 notes.txt` +* diff --git a/2026/day-07/day-07-linux-fs-and-scenarios.md b/2026/day-07/day-07-linux-fs-and-scenarios.md new file mode 100644 index 000000000..614d75f60 --- /dev/null +++ b/2026/day-07/day-07-linux-fs-and-scenarios.md @@ -0,0 +1,81 @@ +# Day-07 Linux File system hierarchy and practice +---- +## Part-1 : Linux file system Hierarchy +---- + +**/: Root directory, the top level of the file system.** +* Everything, all the files and directories, in Linux are located under ‘root’ represented by ‘/’. +----- +**/home: User home directories**. +* Home directory contains personal directories for the users. The home directory contains the user data and user-specific configuration files. As a user, you’ll put your personal files, notes, programs etc in your home directory. +----- +**/bin: Essential binary executables.** +* The ‘/bin’ directly contains the executable files of many basic shell commands like ls, cp, cd etc. +------ +**/sbin: System administration binaries.** +* This is similar to the /bin directory. The only difference is that is contains the binaries that can only be run by root or a sudo user. You can think of the ‘s’ in ‘sbin’ as super or sudo. +----- +**/etc: Configuration files.** +* The /etc directory contains the core configuration files of the system, use primarily by the administrator and services, such as the password file and networking files. +----- +**/var: Variable data (logs, spool files).** +* Var, short for variable, is where programs store runtime information like system logging, user tracking, caches, and other files that system programs create and manage. +----- +**/usr: User programs and data.** +* in ‘/usr’ go all the executable files, libraries, source of most of the system programs. For this reason, most of the files contained therein is read­only (for the normal user). +* ‘/usr/bin’ contains basic user commands +* ‘/usr/sbin’ contains additional commands for the administrator +* ‘/usr/lib’ contains the system libraries +* ‘/usr/share’ contains documentation or common to all libraries, for example ‘/usr/share/man’ contains the text of the manpage +------- +**/lib: Shared libraries.** +* Libraries are basically codes that can be used by the executable binaries. The /lib directory holds the libraries needed by the binaries in /bin and /sbin directories. +----- +**/tmp: Temporary files.** +* As the name suggests, this directory holds temporary files. Many applications use this directory to store temporary files. Even you can use directory to store temporary files. +-------- +**/opt: Third-party applications.** +* Traditionally, the /opt directory is used for installing/storing the files of third-party applications that are not available from the distribution’s repository. +------ +**/mnt: mnt is used by system administrators to manually mount a filesystem.** + +---- +**/dev: This directory only contains special files, including those relating to the devices. These are virtual files, not physically on the disk.** +* /dev/null: can be sent to destroy any file or string +* /dev/zero: contains an infinite sequence of 0 +* /dev/random: contains an infinite sequence of random values +----- +**/boot: The ‘/boot’ directory contains the files of the kernel and boot image, in addition to LILO and Grub. It is often advisable that the directory resides in a partition at the beginning of the disc.** + +---- +**/proc – Process and kernel files.** +* The ‘/proc’ directory contains the information about currently running processes and kernel parameters. The content of the proc directory is used by a number of tools to get runtime system information. +------- +**/root – The home directory of the root.** +* There is /root directory as well and it works as the home directory of the root user. So instead of /home/root, the home of root is located at /root. Do not confuse it with the root directory (/). +-------- +**/media – Mount point for removable media.** +* When you connect a removable media such as USB disk, SD card or DVD, a directory is automatically created under the /media directory for them. You can access the content of the removable media from this directory. +---- +**/mnt – Mount directory.** +* This is similar to the /media directory but instead of automatically mounting the removable media, mnt is used by system administrators to manually mount a filesystem. +---- +**/srv – Service data** +* The /srv directory contains data for services provided by the system. For example, if you run a HTTP server, it’s a good practice to store the website data in the /srv directory. +---- +## Part-2 : Scenario-based Practice +---- + +* **step 1:** I install the nginx service using `sudo apt install nginx` & run (on my web browser using public ip). +* **step 2:** I checked status of the nginx service using `systemctl status nginx`. +* **step 3:** I enable nginx service is enabled on boot using `systemctl is-enabled nginx. +* **step 4:** I disable nginx service is disabled on boot using `sudo systemctl disable nginx. +* **step 5:** I checked cpu usage, cpu percentage & PID, service running of the nginx service using- +* `ps`, +* `top`, +* `htop`, +* `ps aux --sort=-%cpu | tail -10`. + + + + diff --git a/2026/day-08/day-08-cloud-deplayment.md b/2026/day-08/day-08-cloud-deplayment.md new file mode 100644 index 000000000..d7e4fae7b --- /dev/null +++ b/2026/day-08/day-08-cloud-deplayment.md @@ -0,0 +1,21 @@ +# Day-08 Cloud Server Setup: Nginx & Web deployment Task done. + +------- +Screenshots of +* Connecting EC2 server in my local machine via ssh. +* installed nginx service in my web server. +* running nginx service on web browser. +* checked all access and error logs of nginx. +* exported from /var/log/nginx to /home/ubuntu of access and error logs files +* logs files imported in my local macine via scp -i. +----- +![20260202_173626](https://github.com/user-attachments/assets/9c627178-23f9-409a-87c8-f45f6bfccc85) + +![20260202_154421](https://github.com/user-attachments/assets/1b8b8146-d277-41d3-ac79-2279e9b2f7bb) +![20260202_154608](https://github.com/user-attachments/assets/06646b2d-ba07-40c8-8b7c-a83fac4af2a1) +![20260202_154719](https://github.com/user-attachments/assets/3bdf8bdb-6e89-42be-9705-d0211bf0f238) +![20260202_155414](https://github.com/user-attachments/assets/77455691-0017-48bb-b4dc-fcfac84d3483) +![20260202_160947](https://github.com/user-attachments/assets/1272fe06-6f05-4100-ad65-d98cf55222d0) +![20260202_171415](https://github.com/user-attachments/assets/2bc38ff1-716d-4242-bdb6-083d984ea22d) +![20260202_171443](https://github.com/user-attachments/assets/5aa46f51-4dc3-4091-b858-1be4d2473c47) +![20260202_173117](https://github.com/user-attachments/assets/72a20efd-55dd-4b39-a292-8962b319a7f9) diff --git a/2026/day-09/day-09-user-management.md b/2026/day-09/day-09-user-management.md new file mode 100644 index 000000000..8c6b83cde --- /dev/null +++ b/2026/day-09/day-09-user-management.md @@ -0,0 +1,41 @@ +# Day 09 Challenge +---- +## Users & Groups Created +- Users: tokyo, berlin, professor, nairobi +- Groups: developers, admins, project-team +----- + +## Group Assignments + +| Group | Users in Groups | +| ----- | --------------- | +| developers | tokyo, berlin | +| admins | berlin, professor | +| project-team | tokyo, nairobi | + +------ + +## Directories Created + +* drwxrwxr-x 2 775 developers 4096 Feb 2 12:57 /opt/dev-project +* drwxrwxr-x 2 root project-team 4096 Feb 2 13:20 /opt/team-workspace/ +----- + +## Commands Used +| Commands | Used for | +| ----- | --------------- | +| `sudo useradd -m -s /bin/bash tokyo` | This command use for add user with bash terminal | +| `cat /etc/passwd` | this command shows you list of users | +| `cd /home` | This command take you to home directory. | +| `sudo groupadd developers` | This command use to add group. | +| `sudo usermod -aG developers tokyo` | This command use to add user to group. | +| `sudo mkdir -p /opt/dev-project` | This command is use to create directory. | +| `sudo groupadd -f developers` | This command is used to add group. | +| `sudo chown :developers /opt/dev-project` | This command is use for change ownership of directory. | +| `sudo chmod 775 /opt/dev-project` | This command is use for change permission of directory. | +| `ls -ld /opt/dev-project` | This command is use to show directory. | +| `sudo -u tokyo touch /opt/dev-project/tokyo_file` | This command is use to create file in directory through user. | +| `ls -l /opt/dev-project/tokyo_file` | This command is use to show directory. | +| `sudo -u berlin touch /opt/dev-project/berlin_file` | This command is use to create file in directory through user | +| `ls -l /opt/dev-project/` | This command is use to show directory. | +| `sudo chgrp project-team /opt/team-workspace` | This command is used to change group of directory. | diff --git a/2026/day-10/day-10-file-permissions.md b/2026/day-10/day-10-file-permissions.md new file mode 100644 index 000000000..786fc3da6 --- /dev/null +++ b/2026/day-10/day-10-file-permissions.md @@ -0,0 +1,63 @@ +# Day 10 – File Permissions & File Operations Challenge +--------- +## Files Created +* File created `devops.txt` +* File created `notes.txt` +* File created `script.sh` + +--------- +## Permission Changes +* **Before** -rw-rw-r-- read and write permissions have owner and group, others have only read permission. +* **After devops.txt** -r--r--r-- read permission have owner, group and others. +* **After notes.txt** -rw-r----- read and write permissions have owner, group have read write, others haven't any permission. +* **After script.sh** -rwxrw-r-- read, write, execute permissions have owner, group have read, write permissions and others have only read permission. + +| file | permissions (Before) | permissions (after) | +| ---- | -------------------- | ------------------- | +| `devops.txt` |`-rw-rw-r-- 1 ubuntu ubuntu 0 Feb 3 09:58` | `-r--r--r-- 1 ubuntu ubuntu 0 Feb 3 09:58` | +| `notes.txt` | `-rw-rw-r-- 1 ubuntu ubuntu 0 Feb 3 09:58` | `-rw-r----- 1 ubuntu ubuntu 87 Feb 3 10:14` | +| `script.sh` | `-rw-rw-r-- 1 ubuntu ubuntu 0 Feb 3 09:59` | `-rwxrw-r-- 1 ubuntu ubuntu 260 Feb 3 10:09` | +------ + +## Commands Used +| commands | Used for | +| -------- | -------- | +| `touch` | This command is use to create a new file. | +| `ls -l` | This command is use to show detailed information of files. | +| `echo "Line 1" > notes.txt` | This command is use to write a Line 1 in file. | +| `echo "Line 2" >> notes.txt` | This command is use to append and write a Line 2 in file. | +| `echo "Line 3" /| tee -a notes.txt` | This command is use to append and print a Line 3 in file. | +| `cat notes.txt` | Cat command is use to print the file. | +| `vim script.sh` | vim is a editor in linux to write a file. for inserting press i, for save esc, :wq and hit enter. | +| `head -n 5 /etc/passwd` | This command show first 5 system's user account database. | +| `tail -n 5 /etc/passwd` | Thi command displays the last five lines of the user account file | +| `view script.sh` | This command is use for view file | +| `vim -R script.sh` | This command is use for readonly mode in vim | +| `chmod u+x script.sh` | It add execute permission for the user (owner) of the file. | +| `./script.sh` | This command is use to execute the file | +| `mkdir -p project` | This command is use to create a directory for prevention of error if directory is existing. | +---------- +When i try to write something or redirecting something to the file i got an error message. +----- +* ubuntu@ip-172-31-45-52:~$ `cat devops.txt` +* ubuntu@ip-172-31-45-52:~$ `echo "Hello devops" > devops.txt` +* `-bash: devops.txt: Permission denied` +--------- +When i try to execute the file without execution permission i got an error message. +---- +* ubuntu@ip-172-31-45-52:~$ `./notes.txt` +* `-bash: ./notes.txt: Permission denied` +--------- +## What I Learned +* Files are not executable when it's haven't a permission for execution. +* Files aren't writable when it's haven't permission for writing. +* When you try to execute, read, write any file first check the file permissions. + +----------- + + + + + + +