Operations 14 min read

Essential Linux & Windows Sysadmin Interview Q&A with Real Answers

This article compiles a comprehensive set of Linux and Windows system administration interview questions—covering software installation, remote access tools, network configuration, backup scripting, MySQL security, replication, user management, and essential command-line utilities—along with concise, practical answers and code examples.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Essential Linux & Windows Sysadmin Interview Q&A with Real Answers

1. Common methods to install and uninstall Linux software

A. Remove RPM package: rpm -e XXX.rpm (add --nodeps to ignore dependencies). B. yum remove xxx.rpm is not recommended because it may remove dependent packages and break the system. C. For source packages, navigate to the installation directory and run make uninstall, or simply delete the installation directory.

2. Common remote connection tools for Windows and Linux

Command‑line tools: Xshell, SecureCRT, PuTTY, SSH client. Graphical tools: Xmanager (requires service and port 177), VNC‑Viewer (Linux needs vncserver), Windows Remote Desktop (Linux needs xrdp and VNC).

3. How to modify Linux IP address, gateway and hostname

Edit /etc/sysconfig/network-scripts/ifcfg-eth0 and set IPADDR and GATEWAY (ensure BOOTPROTO=static). Edit /etc/sysconfig/network and set HOSTNAME=your_hostname.

4. Bash script for daily backup at 5 AM

#!/bin/bash
# scripts for dir backup and upload to ftp server.
bakdir=mylog
date=$(date +%F)

cd /var
tar zcf ${bakdir}_${date}.tar.gz ${bakdir}

sleep 1

ftp -n <<-EOF
open 192.168.142.129
user aaa bbb
put ${bakdir}_${date}.tar.gz
bye
EOF

rm -rf ${bakdir}_${date}.tar.gz   # optional: verify upload before deletion

Add to crontab:

00 05 * * * /bin/bash /root/mylogbak.sh

5. IPTABLES related commands

(Answer not provided; users are invited to contribute.)

6. Improving MySQL security after a fresh installation

A. Change the default MySQL port. B. Use iptables to restrict access to the MySQL port. C. Set strong passwords for all users and bind each account to specific host IPs. D. Harden the root account with a strong password and local‑only login. E. Enable binary log and slow‑query log. F. Set proper permissions on MySQL installation, log and data directories. G. Remove unused MySQL accounts and the default test database.

7. MySQL master‑slave replication principle and configuration

Replication involves three steps: A. Master writes changes to the binary log. B. Slave copies the binary‑log events to its relay log. C. Slave replays the relay log to apply the changes.

8. Adding a MySQL user

Example:

mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON book.* TO 'test2'@'localhost' IDENTIFIED BY 'abc';

Syntax:

GRANT <privileges> ON <db>.<table> TO 'user'@'host' IDENTIFIED BY 'password';

9. Patching 100 Windows servers

Use a dedicated update server in the domain and the “publish and assign” feature to push patches to all machines.

10. Enabling 3‑4 GB memory support on Windows Server 2003/2008

Add the switch /PAE to the last line of boot.ini, then reboot.

11. iptables rule to allow host 192.168.1.2 access to port 80

iptables -A INPUT -p tcp -s 192.168.1.2 --dport 80 -j ACCEPT

12. Shell script to create group class and users std01 ‑ std30

#!/bin/bash
groupadd class
user=std
for i in {01..30}; do
    useradd -G class ${user}$i
done

13. Show all MySQL connections

SHOW FULL PROCESSLIST;

14. Deleting old MySQL binary logs

Set expire-logs-days=7 in my.cnf and restart MySQL, or run: PURGE BINARY LOGS TO 'mysql-bin.000003'; Or use:

PURGE BINARY LOGS BEFORE '2021-01-01';

Additional useful commands

List directories in /test: ls -d */, find . -type d -maxdepth 1, ls -F | grep '/$',

ls -l | grep '^d' | awk '{print $9}'</p>
<p>Tar exclude file <code>b

: tar --exclude /etc/a/b -zcvf /home/a/a.gz /etc/a Make a file executable: chmod +x a.sh umask 022 results in default permissions 755 for directories and 644 for files.

View files opened by a process: lsof -p <pid> Capture HTTP traffic on eth0: tcpdump -i eth0 port 80 Delete all files under /a/b: rm -rf /a/b/* Network management tools (Windows): ipconfig, ping, tracert, nslookup, telnet. Linux: ifconfig, ping, traceroute, dig, nslookup, telnet.

Common service ports: FTP 21, HTTPS 443, SMTP 25, POP3 110, SSH 22.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxmysqlinterview-questionsSystem Administration
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.