How to Examine a Remote Linux Server via SSH: A Sysadmin's Guide.
As a system administrator, one of the key skills you need is the ability to examine and troubleshoot a remote Linux server via SSH. Whether you're dealing with a new server or stepping into an unfamiliar environment, this brief guide serves as a starting point outlining essential steps to gather information, troubleshoot issues, and ensure the smooth operation of the system.
Step-by-Step Procedure
Connect via SSH
Use the ssh
command to connect to the remote server. Replace username
with your actual username and hostname
with the server's IP address or host name.
ssh username@hostname
If the SSH port is different from the default (port 22), specify the port using the -p
option:
ssh -p PORT username@hostname
You may be prompted for a password or key passphrase. Enter the correct credentials to authenticate.
Gather Basic Information
Use basic Linux commands to gather information about the system. Some useful commands include:
uname -a
: Displays information about the system.lsb_release -a
: Shows Linux distribution details.hostnamectl
: Provides information about the system and its configuration.
Explore the Filesystem
Navigate through the filesystem to understand its structure:
cd /
: Change to the root directory.ls -l
: List the contents of the current directory with detailed information.pwd
: Display the present working directory.
Check System Logs
Examine system logs for any errors or issues. Common log files of interest include:
/var/log/syslog
: logs everything, except authentication related messages./var/log/messages
: logs non-debug and non-critical messages on older systems.
In more recent versions, that use the systemd
init system, you can use the journalctl
to examine log files. To show all log entries in reverse chronological order, execute journalctl -r
.
Identify the Package Manager & Install Basic Tools
Common package managers include apt
(Debian/Ubuntu), or dnf
(Fedora/Red Hat). Newer versions of Ubuntu also use the snap
packaging system. If you want to install additional tools for examining the system, update the package manager's repository information and then install the respective package. Using apt
as an example:
sudo apt update
sudo apt install <package>
Check Network Configuration
Examine the network configuration using commands like ifconfig
or ip a
and check network-related files in /etc/network/
.
Security Checks
Perform basic security checks by looking at the running services:
netstat -tupln
and reviewing firewall settings, which are often managed by iptables
or firewalld
.
User and Group Information
Use commands like less /etc/passwd
, less /etc/group
, and getent passwd
to gather information about users and groups.
Check System Resources
Verify system resource usage with commands like top
, htop
, or free -m
.
Investigate Running Processes
Use ps aux
to view all running processes and identify any suspicious ones.
Check Disk Usage
Analyze disk usage with df -h
to identify space distribution on different partitions.
Review Configuration Files
Examine important configuration files in /etc/
related to services, network, and system settings. For example to view the contents of the SSH daemon configuration file, use cat /etc/ssh/sshd_config
.
Conclusion
Learning to use SSH and the tools mentioned is crucial for any system administrator working with remote Linux servers. The basic steps for examining and troubleshooting these machines enable you to gather valuable information, check important configurations and investigate running processes.
Remember, the specifics might vary based on the Linux distribution running on the remote computer. Therefore, understanding your distribution's package manager and file locations is beneficial. This also applies to specific applications, such as email and web servers. Always prioritize security and adhere to best practices during your examination.
To continue exploring and enhancing your Linux system administrator skills, check out the man pages of the commands and the resources below.
Resources
Featured Merch
Latest Posts
- Open Applications in Fullscreen on Ubuntu
- Manage Long-Running Tasks with Screen on a Remote Linux Server
- Troubleshooting External Hard Drives on Linux
- How to Prevent SSH Timeout on Linux Systems
- Getting Started with Print-on-Demand Merchandise
Featured Book
Subscribe to RSS Feed
This post was written by Ramiro Gómez (@yaph) and published on . Subscribe to the Geeksta RSS feed to be informed about new posts.
Disclosure: External links on this website may contain affiliate IDs, which means that I earn a commission if you make a purchase using these links. This allows me to offer hopefully valuable content for free while keeping this website sustainable. For more information, please see the disclosure section on the about page.
Share post: Facebook LinkedIn Reddit Twitter