Linux system hardening commands

Securing a system against threats requires reducing vulnerabilities, tightening access, and disabling unnecessary services. Here are useful Linux commands for that 😎👆 #linux #softwaredeveloper #TechTips #upskill

Find high-res pdf books with all my #cybersecurity related infographics at https://study-notes.org

2025/7/19 Edited to

... Read moreWhen I first started diving into Linux, I quickly realized that installing it wasn't enough; keeping it secure was a whole different challenge! It felt overwhelming at first, but over time, I've developed a routine and a solid checklist to ensure my systems are hardened against common threats. One of my first and most crucial steps is always keeping the system updated. Whether I'm on a Debian/Ubuntu system using sudo apt update && sudo apt upgrade, a Fedora/RHEL system with sudo dnf update --security to get those vital security patches, or an Arch Linux machine with sudo pacman -Syu, it’s non-negotiable. Outdated software is a common entry point for attackers, so this is my first line of defense. Next, I focus on user and SSH security. I always disable direct root login via SSH by setting PermitRootLogin no in the sshd_config file and enforce strong, unique passwords for all users. For remote access, I exclusively use key-based authentication, which is far more secure than passwords. As an extra layer of obscurity, I often change the default SSH port. Regularly checking for inactive user accounts and removing them (e.g., using lastlog -b 90 for users not logged in for 90 days) is also part of my routine. A properly configured firewall is another critical component. On Ubuntu, I typically use ufw (sudo ufw enable, sudo ufw allow ssh, sudo ufw allow http), while on other distributions, firewalld is my go-to. The key is to only open the ports that are absolutely necessary. To keep tabs on what's exposed, I regularly use ss -tuln (or netstat -tuln on older systems) to monitor open ports and identify any unexpected services listening. Incorrect file permissions are a silent killer in terms of security. I make it a habit to regularly review critical system files and directories. Tools like find / -perm /o+w -type f 2>/dev/null can help me quickly spot world-writable files that shouldn't be, which are major security holes. Ensuring my ~/.ssh directory and its contents have strict permissions (chmod 700 ~/.ssh and chmod 600 ~/.ssh/authorized_keys) is always on my checklist. Minimizing the attack surface also means disabling unnecessary services. I often use systemctl list-units --type=service --state=running to see what's active and then sudo systemctl disable <service_name> for anything I don't need. This is also where systemd-analyze blame proves useful; it not only helps optimize boot times but can also identify services running longer than expected, which might hint at issues or simply unnecessary processes that can be disabled. Finally, I rely on automated tools to catch what I might miss. Lynis is fantastic for this! Running sudo lynis audit system gives me a comprehensive report, including a 'hardening index' and actionable suggestions for improvement across various aspects like system configuration, software vulnerabilities, and network settings. It’s an invaluable tool for ensuring I'm ticking off all the boxes on my 'linux hardening security checklist' and continuously improving my security posture. Don't forget to check for any lingering legacy services and, if applicable, implement policies for USB device control to prevent unauthorized use. Hardening a Linux system is definitely an ongoing process, not a one-time task. By consistently applying these steps and regularly reviewing your system, you can significantly enhance its security and keep it resilient against threats!

11 comments

Mama Mack😍's images
Mama Mack😍

Thank you

Related posts

A list of Linux security hardening commands by Dan Nanni, study-notes.org. It covers system updates, account locking, firewall setup, SSH configuration, file permission checks, package management, service inspection, port checking, USB whitelisting, legacy service checks, and security auditing.
Linux security hardening commands
Locking down a Linux system comes down to shrinking the attack surface, tightening access, and cutting off anything unnecessary—here are the commands that help you do it 😎👆 Find high-res pdf ebooks with all my cybersecurity related infographics at https://study-notes.org/cybersecurity-ebook.html
Dan Nanni

Dan Nanni

4 likes

Free Software Engineering Courses from IBM
If you are interested in Software Engineering, these FREE courses from IBM make learning easy and accessible for everyone 1. Introduction to Cloud Computing. In this course you are going to learn about: * Define cloud computing and explain essential characteristics, history, the business case fo
Ivy League Help

Ivy League Help

69 likes

User management commands for Linux
Even on a single-user Linux system, multiple accounts keep root actions separate, run services with least privilege, and let you test things without breaking your main environment. Here are essential Linux commands for user management 😎👆 Find high-res pdf ebooks with all my Linux related info
Dan Nanni

Dan Nanni

2 likes

Linux user management commands
Even on a single-user Linux system, having multiple user accounts is important for separating administrative tasks, securely running background services, and safely experimenting without affecting your main environment Here are essential Linux commands for user management 😎👆 #devops #softwar
Dan Nanni

Dan Nanni

5 likes

Free Back-End Development Courses from IBM
If you are interested in Back-End Development, these FREE courses from IBM make learning easy and accessible for everyone 1. Hands-on Introduction to Linux Commands and Shell Scripting. In this course you are going to learn about: * Describe the Linux architecture and common Linux distributions
Ivy League Help

Ivy League Help

20 likes

Linux commands for hardware information
Knowing your hardware is essential for effective troubleshooting, system tuning, and performance optimization. That’s why it’s important to be familiar with the OS tools that let you examine different parts of your system’s hardware Here are a list of useful Linux commands for looking up hardwar
Dan Nanni

Dan Nanni

3 likes

Powerful Websites
#freewebsite #website #fromsoftware #fyplemon8 #fyp
Tha Smoke Websites

Tha Smoke Websites

615 likes

Free Computer Science Courses from Dartmouth
If you are interested in Computer Science, these FREE courses from Dartmouth make learning easy and accessible for everyone 1. Linux Basics: The Command Line Interface. In this course you are going to learn about: * Situate on a timeline the key dates of Unix and Linux creation * Use basic comm
Ivy League Help

Ivy League Help

42 likes

#fyp #Lemon8 #tiktok #tech #codember
codember

codember

3 likes

Crown CarPlay effect
Crown CarPlay effect #appel car play #carplay #toyota #linux #androidauto
QUN MO

QUN MO

1 like

Beginner Streamer Tips
realized this vid is pretty fast so comment if you need me to go more in depth or if you need help!!! <3 #obs #streamingtips #beginnerstreamer
melo.byx

melo.byx

10 likes

An infographic titled 'Linux Filesystem Commands' lists common and filesystem-specific commands for EXT, ZFS, Btrfs, and XFS. Each command, like mkfs, df, e2fsck, zpool, btrfs, and xfs_repair, is accompanied by a brief description of its function, created by Dan Nanni.
Useful Linux filesystem commands
Linux filesystem tools fall into two categories: filesystem-independent commands that work across different filesystems, and filesystem-specific commands that are tailored for particular filesystems, utilizing their distinct features and structures Here are a list of useful Linux filesystem comm
Dan Nanni

Dan Nanni

5 likes

Linux command chaining
POSIX-compliant Linux shells (bash, zsh, sh) support command chaining — a simple way to link multiple commands and control whether the next one runs based on success, failure, or just order of execution 😎👆 Find a high-res pdf book with all my Linux related infographics from https://study-notes.o
Dan Nanni

Dan Nanni

6 likes

These 5 websites feel illegal to know!
#gettoknowme
Useful AI Websites & Tutorials

Useful AI Websites & Tutorials

30 likes

A Linux I/O Redirection cheat sheet created by Dan Nanni, detailing various shell commands for redirecting, appending, and combining standard input, output, and error streams. It includes examples like `cmd < file`, `cmd > file`, `cmd 2> file`, `cmd > file 2>&1`, and `cmd <<< "string"` with their corresponding descriptions.
Linux I/O redirection cheat sheet
Here is a concise reference of Linux shell operators for redirecting, appending, and combining standard input, output, and error streams 😎👇 Find high-res pdf ebooks with all my Linux related infographics at https://study-notes.org #linux #sysadmin #infosec #devops #softwareengine
Dan Nanni

Dan Nanni

6 likes

best networking commands to use
I use these networking commands to troubleshoot where my data and messages are going try these commands on a terminal windows Mac or Linux you might be surprised what you find follow share like and visit infotechmentor.com #informationtechnology #infotechmentor #techcareer #te
alt+control+start

alt+control+start

3 likes

An infographic titled 'Understanding Linux Signals' illustrates signal sources like kernel-detected faults, system calls, and kernel subsystems. It shows how processes handle signals through default actions, custom handlers, or ignoring them. A table details common signals, their numbers, default actions, and triggering conditions.
Understanding Linux signals
“Signals” provide a lightweight mechanism for the Linux kernel and other processes to asynchronously notify a running process about events such as faults, user interrupts, or system conditions 😎👆 Find high-res pdf ebooks with all my Linux related infographics at https://study-notes.org #linu
Dan Nanni

Dan Nanni

7 likes

LEVEL UP
#linux #technology #cybersecurity #code
Luna Bright

Luna Bright

2 likes

A woman stands on a palm-lined street with text overlay 'FREE COURSES you can take online to boost your resume' and logos for Udemy and Coursera, promoting free online learning platforms.
A screenshot of Google search results for 'free udemy courses' and a list of various free Udemy courses like 'Canva Essentials' and 'Git & GitHub Crash Course', demonstrating options for professional development.
A screenshot of Coursera's 'Popular Free Courses' section, showcasing university-partnered courses from institutions like Yale and Princeton, highlighting options for resume-boosting education.
FREE courses to put on your resume 💻
What do I love more than online learning? FREE online learning! Popular online course providers like Udemy and Coursera offer libraries of free courses anyone can take! And they span a huge variety of topics from coding to public speaking to art history. In today’s job market, having in deman
hannah 💟

hannah 💟

510 likes

An infographic titled 'Linux Commands for Hardware Info' by Dan Nanni, listing various Linux commands and their functions for checking hardware components like CPU, memory, storage, network, display, and peripherals, along with system information.
Linux commands for hardware information
Here are useful Linux commands for looking up hardware information such as hardware vendor or model info 😎👆 #sysadmin #devops #opensource #TechTips Find high-res pdf books with all my #Linux related infographics at https://study-notes.org
Dan Nanni

Dan Nanni

2 likes

I’m Linuxvr!
#gettoknowme #gorillatag #fyp #newcontentcreator #linux
🧑‍💻🐧Linuxvr_Offical🐧🧑‍💻

🧑‍💻🐧Linuxvr_Offical🐧🧑‍💻

1 like

Useful systemd commands
Systemd tools like systemctl and journalctl are key utilities in Linux for controlling system services—allowing you to start, stop, and check the status of services, as well as view system logs for troubleshooting Here is a list of useful systemd commands 😎👆 #softwaredeveloper #softwareengin
Dan Nanni

Dan Nanni

2 likes

Fujitsu Alphard upgraded with CarPlay, unbeatable
Fujitsu Alphard upgraded with CarPlay, unbeatable sound quality #carplay #toyota #lexyus #linux #carplayinterface Ourisman Chantilly Toyota
CAR TEC

CAR TEC

2 likes

Useful sysdig command examples
Sysdig is one of those hidden gem tools that shows exactly what your Linux system is doing in real time — system calls, containers, network traffic, file access — everything, no guessing. Here are useful sysdig command examples 😎👆 Find high-res pdf ebooks with all my cybersecurity related inf
Dan Nanni

Dan Nanni

5 likes

A computer monitor displays a Linux Mint desktop with its distinctive logo. The screen shows numerous folders labeled with names of classic gaming systems such as Sega Genesis, Atari 2600, Gameboy, Super Nintendo, MAME Roms, Neo Geo CD, Nintendo 64, Nintendo DS, PS2, and PS3.
Linux Mint User
I don't have windows installed on my computer at all. I use Linux Mint and I absolutely love it! #linux #computer #Lemon8Diary
Robert Ramos

Robert Ramos

10 likes

Yazi: a terminal-based Linux file manager
Yazi is a blazingly fast terminal file manager written in Rust, based on non-blocking async I/O. It aims to provide an efficient, user-friendly, and customizable file management experience within Linux terminals. A strong contender for the best TUI-based file manager title 😎👆 Find high-res pdf
Dan Nanni

Dan Nanni

3 likes

Stop paying monthly for AI tools
Pinokio lets you run video, image and voice models like Flux, Stable Diffusion and Wan locally on your computer with unlimited private usage, no internet needed.
Krofile.com

Krofile.com

0 likes

A Linux watch command cheatsheet created by Dan Nanni, listing various commands to monitor system metrics in real-time. Examples include tracking CPU/memory usage, disk space, log file growth, network activity, and system errors, with refresh intervals specified.
Linux watch command cheatsheet
Ever wish you could just run a command and keep seeing it update automatically as things change? That is exactly what the watch command does on Linux Here are useful examples of the watch command 😎👆 Find high-res pdf ebooks with all my Linux related infographics at https://study-notes.org
Dan Nanni

Dan Nanni

4 likes

Starting Linux? I remember those days.
Here are a few commands, the basics that will help with more complex code down the line. #linux #knowledge #tech #TechTips
Lemon8

Lemon8

39 likes

An infographic titled "Linux Command Chaining" explains various command chaining methods. It covers sequential chaining, conditional execution for success (&&) and failure (||), combined success/failure conditions, pipelines (|), and redirection (>, >>), each with a command example. The graphic is created by Dan Nanni from study-notes.org.
Linux command chaining
POSIX-compliant Linux shells like bash, zsh and sh provide a feature called “command chaining”, which lets you connect multiple commands using specific operators to control their execution based on success, failure or sequence 😎👆 #software Find high-res pdf books with all my #linux infogra
Dan Nanni

Dan Nanni

3 likes

This image displays a table titled 'Deprecated Linux Command Usage' by Dan Nanni. It compares various deprecated Linux commands like ifconfig, netstat, fdisk, route, and arp with their modern, up-to-date alternatives such as ip and ss, providing a description for each command's function.
Deprecated Linux command examples
Just like anything else, even widely used Linux tools can become outdated as better and more efficient options emerge. Once deprecated, these tools typically stop receiving new features or security updates, even if they’re still accessible. While it can be tough to move on from familiar habits,
Dan Nanni

Dan Nanni

8 likes

How Linux pipes work
Linux has two simple ways for programs to pass data: one temporary and invisible, the other a file you can see and reuse. Here is a quick comparison between anonymous and named pipes 😎👆 Find high-res pdf ebooks with all my Linux related infographics at https://study-notes.org/linux-ebook.html
Dan Nanni

Dan Nanni

2 likes

An infographic titled 'Linux curl Command Examples' provides a comprehensive list of curl commands. It covers HTTP GET operations with options like user-agent and custom headers, HTTP POST/PUT operations for data and file uploads, and various file download operations including resuming and rate-limiting. Created by Dan Nanni.
Linux curl command examples
The curl command is a flexible tool that lets you send or receive data from servers using protocols like HTTP, HTTPS, FTP, and others, all from the command line Here are useful curl command examples 😎👆 #devops #opensource #software #TechTips Find high-res pdf books with all my #lin
Dan Nanni

Dan Nanni

7 likes

Useful Linux filesystem commands
Linux filesystem tools are divided into two types: those that work universally across all filesystems, and those designed for specific filesystems, taking advantage of their unique features and layout Here are useful Linux filesystem commands 😎👆 #devops #softwaredeveloper #TechTips #sof
Dan Nanni

Dan Nanni

6 likes

Android file system hierarchy
Android uses a Linux based file system organized into several main areas. /system stores the core OS files, /data holds installed apps and user data, and /storage provides access to internal and external storage where files like photos and downloads live 😎👆 Find high-res pdf ebooks with all my t
Dan Nanni

Dan Nanni

11 likes

Student Teaching Series: What to bring to student teaching!! Please let me know if you guys have ANY questions and I will do my best to make videos over the next couple weeks for you. I’m an open book and would LOVE to pass on anything I’ve learned. ☺️ #teachersoftiktok #middleschoolteacher
Kelly Having

Kelly Having

5 likes

An infographic titled 'Linux /proc Filesystem' by Dan Nanni, listing various /proc entries and their functions. It details how to access real-time system information, including CPU, memory, network, disk I/O, kernel, and process-specific data, presented with folder icons on a dark background.
Linux /proc filesystem
The /proc filesystem in Linux is a virtual gateway to real-time system info, from hardware stats to kernel parameters, letting you monitor and tweak your system on the fly Here are some of the most useful /proc entries 😎👆 #TechTips #software #softwaredeveloper Find high-res pdf books
Dan Nanni

Dan Nanni

5 likes

Transforming Your Legion Go into a Steam Deck 🎮
The Lenovo Legion Go is a powerhouse, but for many, the Windows 11 experience can feel a bit clunky on a handheld. In this video, we’re diving deep into the world of alternative operating systems to bring that seamless, console-like SteamOS experience to Lenovo’s flagship handheld. We'll walk
its_just_torrey

its_just_torrey

3 likes

An infographic titled 'Linux /proc Filesystem' by Dan Nanni, featuring the Linux penguin mascot. It lists numerous /proc entries like /proc/cpuinfo, /proc/meminfo, and /proc/[PID]/status, detailing the system information each provides, such as CPU, memory, and process statistics.
Linux /proc filesystem
The Linux /proc filesystem is a virtual interface that exposes live system information and kernel parameters, enabling users to monitor hardware and processes and adjust kernel settings at runtime Here are a list of useful /proc entries 😎👆 #software #softwaredeveloper #computer Find
Dan Nanni

Dan Nanni

5 likes

🛑 Stop paying for Photoshop or struggling with Canva limitations… 🎯 GIMP is the free design software I teach all my students to use—and it works like a charm for custom products. 👩🏽‍💻 In this quick tutorial, I’ll show you exactly how to download it, set it up, and pin it to your desktop so you’r
www.DesigningMadeEasy.com

www.DesigningMadeEasy.com

14 likes

An infographic titled 'Network Troubleshooting on Linux' by Dan Nanni. It displays a table listing Linux commands categorized by OSI layer (Transport, Network, Data Link, Physical) and their corresponding troubleshooting plans. Commands like `ss -tunlp`, `ping`, `traceroute`, `tcpdump`, and `ethtool` are shown for diagnosing network issues.
Linux commands for network troubleshooting
When you run into a network issue on your Linux system, the key to solving it is narrowing down the root cause across the different layers of the OSI model. Since the problem could be anywhere, from the physical link to the application layer, you will need to rely on a variety of Linux tools, each
Dan Nanni

Dan Nanni

12 likes

Programming an Arduino as a serial controller
I programmed an Arduino Mega to be a serial controller for Xlights to control WS2811 addressable LEDs I am working on the last two videos for the DIY Christmas Light Controller mini-series, and it's finally time to start controlling LEDs. My original plan was to use an ESP32 based Light c
EETEngineer

EETEngineer

12 likes

An infographic titled 'Privacy-Focused Linux Distros' lists nine operating systems: Debian, Fedora, Kicksecure, Linux Kodachi, MOFO Linux, Parrot OS, Qubes OS, Tails OS, and Whonix, each with a brief description of its privacy and security features. It also credits Dan Nanni.
Privacy-focused Linux distributions
Privacy focused Linux distros minimize data collection and metadata leakage by default while prioritizing anonymity, isolation, and user control over networking, software behavior, and system telemetry. Here are some of the most popular Linux distros for privacy-conscious users 😎👆 Find high-r
Dan Nanni

Dan Nanni

9 likes

Essential file storage commands for Linux
Master Linux storage management with these essential commands — from disks to file systems. Boost I/O performance and keep your system running fast! 😎👆 #linux #techcreator #softwareengineering #techjob #software Find high-res pdf books with all my Linux related infographics from
Dan Nanni

Dan Nanni

5 likes

An infographic titled 'DNS Troubleshooting on Linux' by Dan Nanni, listing commands to diagnose DNS issues. It includes commands to check systemd-resolved status, find DNS server IP, test server reachability (ping, dig), trace routes, and examine DNS-related logs (journalctl, grep).
Linux commands for DNS troubleshooting
DNS issues can stem from a range of sources, network connectivity failures, misconfigured settings, or problems with the DNS servers themselves, all of which can disrupt domain name resolution Here are commands for diagnosing DNS issues on Linux 😎👇 #softwaredeveloper #technology #TechTips
Dan Nanni

Dan Nanni

4 likes

Estas tres comidas son muy normales que me digan que lo hacen mis pacientes porque no sabían que era algo malo .. estos alimentos son muy altos en su índice glucemico y tiene el poder de subir tu azúcar por lo tanto disminúyelos #nutrióloga #bajarazucar #nutricion #comida
Nutriologaziomaramarquez

Nutriologaziomaramarquez

11 likes

Online learning resources for software developers
Want to pick up a new programming language or master a DevOps tool? No problem! Plenty of great learning resources are available online for free! 😎👆 #devops #coding #programming #softwaredeveloper
Dan Nanni

Dan Nanni

82 likes

An infographic titled 'Useful TUI Linux Software' with a Tux penguin logo. It defines TUI as Text-based User Interface for terminal environments and lists various software categorized under Disk Manager, System Monitor, Web Browser, Network Manager/Monitor, Multimedia, GPT, Git, Coding, File Manager, and Messaging.
Useful TUI software on Linux
Linux TUI (Text User Interface) software offers a user-friendly way to interact with applications directly from the terminal, using text-based menus and interfaces instead of a graphical desktop environment Here are a categorized list of useful TUI software available on Linux 😎👆 #software #o
Dan Nanni

Dan Nanni

4 likes

Becoming a Power User
[English] Today was leg day in the "Operating Systems and You: Becoming a Power User" module. I spent the day mastering the core mechanics of file and directory management across both Windows and Linux. From navigating complex directory trees in Bash to manipulating files via the CLI and G
꧁Encendiogamer꧂

꧁Encendiogamer꧂

3 likes

Survey for top Linux software
Some days I realize how much muscle memory I have around Linux. Certain commands just feel… indispensable. I’m curious — what are the three Linux commands or tools you personally can’t live without? The ones you reach for without thinking. Drop yours in the comments. I’ll collect the response
Dan Nanni

Dan Nanni

2 likes

So you want to “learn Linux”?
Here are the harsh truths nobody tells you… 🐧 Most Linux roles aren’t entry level. The CLI is mandatory. Certs don’t matter without skill. If that scared you… good. Because Linux isn’t for the weak. Still want to continue? #linux #cybersecurity #computerscience
Professor Linux

Professor Linux

1 like

The image illustrates how Linux cgroups manage resources like CPU, Memory, Storage I/O, and Network. It shows creating cgroups, attaching a process (PID 12345) to `cgroup3` via `/sys/fs/cgroup/cgroup3/cgroup.procs`, and defining its resource limits (e.g., 512M memory.max, 10M/5M disk I/O).
How Linux cgroups work
On Linux, cgroups control and isolate CPU, memory, and I/O per process or container—this is what makes predictable container performance possible 😎👆 Find high-res pdf ebooks with all my Linux and DevOps related infographics from https://study-notes.org #linux #docker #kubernetes #de
Dan Nanni

Dan Nanni

1 like

An infographic titled 'Sysdig Command Examples' defines Sysdig as a Linux tracing tool and lists various commands for monitoring CPU, memory, network, file I/O, and capturing events. It's created by Dan Nanni.
Useful sysdig command examples
The sysdig command is a powerful system-level exploration and troubleshooting tool for Linux. Sysdig can capture and analyze real-time system calls and events, enabling deep visibility into processes, containers, network activity, and file access Here are useful sysdig command examples 😎👆 #te
Dan Nanni

Dan Nanni

27 likes

Linux lsof command examples
If I had to pick a personal favorite among lesser-known Linux commands, it would be lsof. It’s my go-to tool for discovering which files are open and which processes are using them. Since everything in Linux is treated as a file, lsof proves to be surprisingly powerful and endlessly useful Here
Dan Nanni

Dan Nanni

3 likes

See more