After learning about permissions, ownership, and package managers in Part 3, I realized that being comfortable with Linux also means being able to manage files, automate tasks, secure access, and work across systems.
This part of my journey dives into some of the most practical everyday tools of a DevOps engineer: archiving, cronjobs, SSH, SCP, virtual machines, and key pairs.
πArchiving & Compression
One of my first real struggles was handling log backups. I had thousands of log files in /var/log/, and transferring them individually was a nightmare.
So I used tar:
tar -cvf logs.tar /var/log/
Output:
/var/log/syslog
/var/log/auth.log
/var/log/kern.log
...
Later, to extract:
tar -xvf logs.tar
Then I tried compressing a single file:
gzip demo.txt
Output:
demo.txt β demo.txt.gz
π Lesson: Instead of moving hundreds of files, I just tar them into one archive, transfer, and extract. Much cleaner.
β° Automating Tasks with Cronjobs
I hated repeating backups manually, so I created a cronjob.
crontab -e
I added:
0 0 * * * /home/user/backup.sh
To check:
crontab -l
Output:
0 0 * * * /home/user/backup.sh
π Troubleshooting: At first, my cronjob didnβt run. The issue? My script used python3, but cron didnβt recognize it. I fixed it by giving the full path:
/usr/bin/python3 /home/user/backup.py
π Security & System Administration Basics
Next, I explored system security.
Creating a new user:
sudo adduser dev
Output:
Adding user `dev' ...
Adding new group `dev' (1002) ...
Creating home directory `/home/dev' ...
Giving sudo rights:
sudo usermod -aG sudo dev
π Lesson: I once mistakenly gave a developer sudo rights when he only needed file access. It taught me that least privilege is key in production.
π Remote Connections with SSH
When I first tried logging into a server:
ssh user@192.168.1.10
It asked for a password β fine. But when I disabled password login, I hit this error:
Permission denied (publickey).
π The fix was to use SSH key pairs.
π Generating SSH Key Pairs
I generated a key:
ssh-keygen -t rsa -b 4096 -C "sheershsinha30@gmail.com"
Output:
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Then copied it to the server:
ssh-copy-id user@192.168.1.10
Now login works without typing a password:
ssh user@192.168.1.10
π» Creating Virtual Machines
- Before trying things on production servers, I practiced on VirtualBox:
- Created a VM with Ubuntu.
- Configured NAT networking.
- Installed nginx inside the VM:
sudo apt install nginx -y
Verified:
systemctl status nginx
Output:
nginx.service - A high performance web server and a reverse proxy server
Active: active (running)
π Lesson: Breaking things in a VM is safe β I just reverted to a snapshot.
π Key Takeaways from Part 4
- Archiving makes backups portable.
- Cronjobs automate repetitive tasks.
- System security is about principle of least privilege.
- SSH & SCP are lifelines for remote management.
- SSH key pairs enable passwordless secure automation.
- Virtual machines provide a safe DevOps sandbox.
π Whatβs Next (Part 5: Shell Scripting)
After learning permissions, automation, and SSH, I realized that typing commands again and again isnβt efficient. Thatβs where Shell Scripting comes in β the real glue of DevOps.
In the next part of my journey, Iβll cover:
- π Introduction to Shell Scripting β Why scripts matter in DevOps.
- βοΈ Write & execute a simple script β Going from one-liners to automation.
- π¦ Variables & Operators β Storing values and doing calculations.
- π€ Read user input β Making scripts interactive.
- π Functions & Loops β Reusing and repeating code smartly.
- β‘ Shell vs sh vs Bash β Whatβs the difference?
- π How to write Bash scripts β Best practices for real-world use.
- π€ Conditional Statements β Adding logic to decisions.
- π₯ Passing Arguments to a Script β Making scripts flexible and reusable.
This will be the point where I move from βjust running commandsβ to building automation workflows β a must-have step for any DevOps engineer.
π€ Over to You
What was your first cronjob or SSH key setup experience like? Did it work on the first try, or did you spend hours debugging like me? Share your story π
Top comments (0)