[Unit] Description=Test NetworkNamespacePath with DynamicUser After=network-online.target Wants=network-online.target [Service] Type=simple # Use DynamicUser to create a temporary user for the service DynamicUser=true # Specify the custom network namespace NetworkNamespacePath=/var/run/netns/vpnspace # Command to test curl inside the namespace ExecStart=/usr/bin/curl ifconfig.co # Set a shorter time for testing purposes TimeoutSec=30 [Install] WantedBy=multi-user.target