linux change user shell /bin/false

C++
usermod -s /sbin/nologin myuser

Source

Also in C++: