I have an application that runs on a Linux
box. The application stores all its user information (like - username
, password
, ssh-allowed
, etc) in an sqlite3
database as follows.
username password ssh-allowed
admin X y
regularuser X n
The application users will login to a GUI to use the application. But all the application users who have their ssh-allowed
as y
are allowed to login to the Linux
box using ssh
. Other application users (with ssh-allowed
as n
) are not allowed to login to the Linux
box using ssh
.
So in the above case admin
user will be allowed to ssh
to the Linux
box but regularuser
will be denied ssh
access to the Linux
box.
W.r.t the GUI, in order to perform authentication
using PAM
for user info stored in sqlite
, I use libpam-sqlite. Actually, I have modified it to work with sqlite3
database and it is available here.
Now to the question: When an application user attempts to login to the Linux
box, How can I perform authentication
and then decide to either allow or deny ssh
access based on the ssh-allowed
parameter that is stored in the sqlite3
database using PAM
(or any other way)?
Please NOTE: All the user info is store in the sqlite3
database only and NOT in /etc/passwd
, /etc/shadow
, /etc/group
files. IOW the application does not have rights to add/remove records in the /etc
files.
NOTE2: I had the same question posted in SO; thought this is a better forum for Linux related questions.