For example here the nologin user is apache
use the below command
sudo -u apache bash
U Specifies the user
apache is the nologin user in my system
bash opens a bash shell with apache as the user
On executiong the command a bash prompt will be opened with apache as the user.
[root@nagios1 ~]# sudo -u apache bash
bash-4.1$
Once you are in Bash prompt you can use any command