KEMBAR78
Lab 4 Configuring A Web Hosting Server | PDF | Secure Shell | Sudo
0% found this document useful (0 votes)
15 views4 pages

Lab 4 Configuring A Web Hosting Server

This document outlines a lab exercise for configuring a web hosting server using SSH and automation, aimed at junior system administrators. It details the steps for setting up SSH access, installing and configuring a web server (Apache or Nginx), and managing user permissions. The lab concludes with instructions for remote server access and emphasizes the importance of secure user management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views4 pages

Lab 4 Configuring A Web Hosting Server

This document outlines a lab exercise for configuring a web hosting server using SSH and automation, aimed at junior system administrators. It details the steps for setting up SSH access, installing and configuring a web server (Apache or Nginx), and managing user permissions. The lab concludes with instructions for remote server access and emphasizes the importance of secure user management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Academic Year: 2024-2025

FGE-USTHB
Module: Administration of Linux
3rd Year Ing TEL
Systems

Lab 4: Configuring a Web Hosting Server with


SSH and Automation
Dr. Mohamed LICHOURI
April 12, 2025

1 Introduction
As a junior system administrator at a web hosting company, your mission is to deploy
a reliable and secure web server environment. This includes enabling remote access
for developers using SSH, and implementing proper user management and permission
controls to ensure efficient and secure operations.
Your responsibilities include:
• Setting up SSH access for remote server management.
• Configuring Apache or Nginx as a web server.
• Managing user access and security for different team members.

2 Part 1: Setting Up the Web Server and SSH Access


1. Install OpenSSH Server and Ensure It’s Running

Terminal
sudo apt update
sudo apt install openssh-server -y
sudo systemctl enable ssh
sudo systemctl start ssh

2. Find Your Server’s IP Address (needed for remote access)

Terminal
ip a | grep inet

3. Install and Configure a Web Server (Apache or Nginx)

Terminal
sudo apt install apache2 -y (For Apache)
sudo apt install nginx -y (For Nginx)

1
4. Verify the Web Server is Running Open a browser and enter: http://your_server_ip
5. Secure SSH by Allowing Only Specific Users

Terminal
sudo nano /etc/ssh/sshd_config

Add the following line: AllowUsers developer1 admin


Then restart SSH:

Terminal
sudo systemctl restart ssh

3 Part 2: Managing Users and Permissions


6. Create a New User for a Developer

Terminal
sudo adduser developer1

7. Grant Web Directory Access to the Developer

Terminal
sudo chown -R developer1:www-data /var/www/html
sudo chmod -R 775 /var/www/html

8. Allow the Developer to Restart the Web Server (but not access every-
thing) Edit the sudoers file:

Terminal
sudo visudo

Add the following line:

developer1 ALL=(ALL) NOPASSWD: /bin/systemctl restart apache2

9. Restrict the Developer from Accessing Other Server Files

Terminal
sudo chmod 750 ./admin

10. Disable SSH Access for Certain Users Edit the SSH configuration file:

Terminal
sudo nano /etc/ssh/sshd_config

Add the following:

2
DenyUsers guest testuser

Restart SSH:

Terminal
sudo systemctl restart ssh

4 Part3: Accessing the Server Remotely


A. From a Mobile Device using Termius:
• Download the Termius app (Android/iOS).
• Tap New Host and enter:
– Address: your_server_ip
– Port: 22
– Username: guest or developer1
– Password: the user’s password
• Tap Save then Connect.
B. From a Windows PC using CMD or PowerShell:
• Open Command Prompt or PowerShell.
• Type:

Command
ssh guest@your_server_ip

• Example:

Example
ssh developer1@192.168.1.100

• If you get a warning about authenticity, type yes and proceed with the password.

5 Conclusion
In this lab, you successfully:
• Set up a Linux web server with Apache/Nginx.
• Configured SSH for remote access.
• Managed user access and permissions securely.
• Connected to your server from a mobile app or Windows terminal.
By completing these steps, you have taken your first step toward real-world server
administration.

3
6 References
• Ubuntu Server SSH Guide: https://ubuntu.com/server/docs/openssh-server

• Linux Web Server Setup: https://www.digitalocean.com/community/tutorials/


how-to-install-the-apache-web-server-on-ubuntu-20-04

• Termius App: https://termius.com

You might also like