Centos User account nologin but possible to su into account
On centos, you would setup with a user with no shell by using /sbin/nologin:
[root@localhost ~]# grep named /etc/passwd
named:x:25:25:Named:/var/named:/sbin/nologin
[root@localhost ~]#
If you need to become that, use -s parameter and put as the argument the shell of your choice, like so:
[root@localhost ~]# su - named -s /bin/bash
-bash-4.1$
Note that if you use bash, it will read the settings from /etc/profile first and will default to those settings if there is no existing .bash_profile, .bash_login or.profile in the user home directory. Of course, if you want to use your existing environment settings that exists in root, you can just remove the dash:
exit [
root@localhost ~]# su - named -s /bin/bash
-bash-4.1$ echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
-bash-4.1$ exit
logout
[root@localhost ~]# su named -s /bin/bash
bash-4.1$ echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
bash-4.1$