Servers

NetCat Server

Server Setup

To set up a NetCat server, run the following command, replacing [port number] with your desired port:

sudo nc -l [port number]

Client Connection

Connect to the NetCat server using:

nc [source ip] [port number]

Apache Server

Version Check

To verify the Apache server version, use:

apachectl -v

Sample Output:

Server version: Apache/2.4.62 (Unix)
Server built: Sep 28 2024 21:07:07

Apache Control Commands

  • Start: apachectl start

  • Stop: apachectl stop

  • Restart: apachectl restart

  • Status: apachectl status

Apache Status

To check the status, ensure mod_status is enabled, then navigate to:

http://localhost:80/server-status

Document Root

Navigate to the web server's document root:

cd /Library/WebServer/Documents

Open index.html.en for editing.

Configuration

Edit the Apache configuration files with:

nano /etc/apache2/httpd.conf

and

nano /etc/apache2/extra/httpd-vhosts.conf

SSH Server

Server Setup

Check and manage the SSH service:

  • Check: sudo launchctl list | grep ssh

  • Start: sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist

  • Stop: sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist

To verify your username and IP address:

whoami  # Check username
ifconfig # Check IP address

Client Connection

For testing on iSH on iPhone, first install the SSH package:

apk add openssh

Connect to the SSH server with:

ssh username@192.168.1.100

Last updated