LAMP Security Best Practices Flashcards
(25 cards)
What are LAMP security best practices?
LAMP security best practices protect Linux, Apache, MySQL, and PHP from threats like hacks and data breaches.
Securing a LAMP stack ensures WordPress or PHP applications remain safe. Freelancers implement security for client sites, while enterprise architects enforce compliance (e.g., GDPR) for high-stakes systems, aligning with your WordPress and PHP security interests.
How do you secure Linux user accounts in LAMP?
Use strong passwords, disable root login, and restrict sudo access with visudo.
Prevents unauthorized server access for WordPress. Freelancers secure client servers, while enterprise architects limit user privileges, per your Linux basics deck.
What is the ufw firewall in Linux for LAMP?
ufw (Uncomplicated Firewall) restricts network traffic, like sudo ufw allow 80/tcp.
Protects Apache and MySQL ports for WordPress. Freelancers enable ufw, while enterprise architects configure advanced rules, per your security focus.
How do you disable root SSH login in LAMP?
Edit /etc/ssh/sshd_config, set PermitRootLogin no, and restart SSH with sudo service ssh restart.
Enhances WordPress server security. Freelancers secure SSH, while enterprise architects use key-based authentication, per your Linux basics deck.
How do you secure Apache in LAMP?
Disable ServerTokens and ServerSignature, enable mod_security, and restrict directory access.
Protects WordPress from information disclosure. Freelancers secure Apache configs, while enterprise architects enforce strict settings, per your Apache deck.
What is the ServerTokens directive in Apache for LAMP security?
ServerTokens Prod minimizes server version disclosure in Apache.
Reduces attack vectors for WordPress. Freelancers set it in httpd.conf, while enterprise architects hide server details, per your WordPress security deck.
How do you enable mod_security in Apache for LAMP?
Install mod_security with sudo apt install libapache2-mod-security2 and enable with sudo a2enmod security2.
Acts as a firewall for WordPress. Freelancers configure rules, while enterprise architects customize for enterprise threats, per your Apache deck.
How do you secure .htaccess in WordPress on LAMP?
Restrict access with <Files .htaccess> Order Deny,Allow Deny from all </Files> and set chmod 644.
Protects WordPress permalinks. Freelancers secure files, while enterprise architects limit overrides, per your WordPress security deck.
How do you secure MySQL in LAMP?
Run sudo mysql_secure_installation, use strong passwords, and restrict user privileges.
Secures WordPress databases. Freelancers configure MySQL, while enterprise architects enforce least privilege, per your MySQL deck.
How do you restrict MySQL user access in LAMP?
Use GRANT with specific privileges, like GRANT SELECT, INSERT ON wp_database.* TO ‘wp_user’@’localhost’;.
Limits WordPress database access. Freelancers set permissions, while enterprise architects audit privileges, per your PHP database deck.
How do you secure PHP in LAMP?
Disable dangerous functions in php.ini (e.g., disable_functions = exec,shell_exec) and set display_errors = Off.
Protects WordPress from exploits. Freelancers secure PHP, while enterprise architects enforce strict configs, per your PHP security deck.
What is open_basedir in PHP for LAMP security?
open_basedir restricts PHP file access, like open_basedir = /var/www/html.
Limits WordPress script access. Freelancers configure it, while enterprise architects restrict directories for multi-site setups.
How do you enable HTTPS in LAMP for WordPress?
Install a certificate (e.g., Let’s Encrypt), enable mod_ssl, and configure <VirtualHost *:443> with SSLEngine on.
Secures WordPress traffic. Freelancers use certbot, while enterprise architects automate renewals, per your Apache and security decks.
ow do you secure wp-config.php in WordPress on LAMP?
Set chmod 600 wp-config.php and move it above /var/www/html if possible.
Protects database credentials. Freelancers secure files, while enterprise architects enforce permissions, per your WordPress on LAMP deck.
How do you secure WordPress uploads in LAMP?
Set wp-content/uploads to chmod 755, restrict file types in .htaccess, and use security plugins.
Prevents malicious uploads. Freelancers secure client sites, while enterprise architects enforce policies, per your WordPress security deck.
What is a nonce in WordPress on LAMP?
A nonce is a one-time token to prevent CSRF, like wp_nonce_field(‘my_action’);.
Secures WordPress forms. Freelancers implement nonces, while enterprise architects enforce them for APIs, per your PHP security deck.
How do you disable directory listing in Apache for LAMP?
Answer: Set Options -Indexes in httpd.conf or .htaccess.
Prevents WordPress directory exposure. Freelancers disable listing, while enterprise architects enforce it, per your Apache deck.
How do you secure Apache logs in LAMP?
Restrict log access with chmod 640 /var/log/apache2/* and chown root:adm.
Protects WordPress logs. Freelancers secure files, while enterprise architects rotate logs securely, per your Linux basics deck.
How do you prevent SQL injection in WordPress on LAMP
Use $wpdb->prepare(), like $wpdb->prepare(“SELECT * FROM wp_posts WHERE ID = %d”, $id);.
Secures database queries. Freelancers implement safe queries, while enterprise architects enforce prepared statements, per your PHP database deck.
What is Fail2Ban in LAMP security?
Fail2Ban bans IPs after failed login attempts, installed with sudo apt install fail2ban.
Protects WordPress from brute-force attacks. Freelancers configure it, while enterprise architects integrate with monitoring, per your security focus.
How do you secure SSH for LAMP servers?
Use key-based authentication, disable password login, and change the SSH port in /etc/ssh/sshd_config.
Secures WordPress server access. Freelancers configure SSH, while enterprise architects enforce keys, per your Linux basics deck.
How do you update LAMP components for security?
Run sudo apt update && sudo apt upgrade for Linux, Apache, MySQL, and PHP.
Patches WordPress vulnerabilities. Freelancers update servers, while enterprise architects automate updates, per your Linux basics deck.
How do you monitor LAMP security for WordPress?
Use tail -f /var/log/apache2/error.log, check MySQL logs, and deploy tools like Wordfence.
Tracks WordPress threats. Freelancers monitor client sites, while enterprise architects use SIEM tools, per your debugging deck.
What is a security audit for LAMP?
A security audit reviews LAMP configurations, logs, and code for vulnerabilities.
Ensures WordPress safety. Freelancers audit client servers, while enterprise architects conduct regular audits, per your WordPress security deck.