Recently, physical-layer authentication (PLA) has attracted much attention since it takes advantage of the channel randomness nature of transmission media to achieve communication confidentiality and authentication. In the complex environment, such as the Industrial Internet of Things (IIoT), machine learning (ML) is widely employed with PLA to extract and analyze complex channel characteristics for identity authentication. However, most PLA schemes for IIoT require attackers’ prior channel information, leading to severe performance degradation when the source of the received signals is unknown in the training stage. Thus, a channel impulse response (CIR)-based PLA scheme named “hierarchical variational autoencoder (HVAE)” for IIoT is proposed in this article, aiming at achieving high authentication performance without knowing attackers’ prior channel information even when trained on a few data in the complex environment. HVAE consists of an autoencoder (AE) module for CIR characteristics extraction and a variational AE (VAE) module for improving the representation ability of the CIR characteristic and outputting the authentication results. Besides, a new objective function is constructed in which both the single-peak and the double-peak Gaussian distributions are taken into consideration in the VAE module. Moreover, the simulations are conducted under the static and mobile IIoT scenario, which verify the superiority of the proposed HVAE over three comparison PLA schemes even with a few training data.