1847170 Members
6261 Online
110263 Solutions
New Discussion

nologin

 
Luca_11
Occasional Contributor

nologin

Hi,
i need to create a user who can log in only by su command. In other words there's must be another user, different from root, logged in.
Whith files /etc/nologin and /etc/default/security i lock access to all users different from root.

Thanks in advance
Bye
Luca
2 REPLIES 2
harry d brown jr
Honored Contributor

Re: nologin

Well, if you have the system "locked" down so that only root can login because you have a /etc/nologin file and you have defined NOLOGIN in /etc/default/security, then the only action is to login as root!

You could detect /etc/nologin yourself via /etc/profile and then allow only those users that have special access to login.

live free or die
harry
Live Free or Die
Cheryl Griffin
Honored Contributor

Re: nologin

Luca,
Add this to the user's .profile:
# Prevent login. Force su.
name=`logname`
if [ $name = username ]
then
echo $name No Login Allowed. Must su.
exit
fi


This prevents the user from logging in directly, and reminds them to use su to gain access to the user account.

Cheryl
"Downtime is a Crime."