First check nologin exists in /etc/shells
$ cat /etc/shells
if nologin is not found then append
# echo "/usr/sbin/nologin" >> /etc/shells
To set a user’s shell to nologin
# usermod <username> -s /sbin/nologin
# usermod ilugc -s /sbin/nologin
regards,
T.Dhanasekar