Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way for people to log onto a debian server via sftp using just mysql database table as authentaction. IE not adding a user to the system?

I know it can be done over ftp and TLS but i really dont want to use that method


share|improve this question
up vote 5 down vote accepted

My two cent suggestion: you could use PAM to do this.

E.g. Use some pam module as pam-mysql to store some of your users in mysql and pam_require to avoid that mysql-stored users can access other than sftp service.

Start looking here: Modules/Applications available or in progress...

share|improve this answer
thats is a very useful link thanks very much, Ill mark this answered as its what im looking for. Cheers – squarebear May 12 '11 at 15:17
Wouldn't you still need to have a UID assigned to each user in this case? i.e. you're adding users anyway; it's just that the UID/password/etc. for some of them are stored in MySQL. I suppose you could use a single UID for all of them, but then they could read and overwrite each other's files. – Jander May 13 '11 at 6:45
@Jander, if users own files in the file system, they must have user ids. We are talking of user authentication, not of user authorization. If you want to avoid user ids, you'll have to write you own "file system" authorization mechanism. – andcoz May 23 '11 at 22:21

No. SFTP works by logging in via SSH and then spawning the sftpd subprocess on the remote end.

You can, however, create a user that cannot log on except for sftp/scp by giving them the scponly program as a login shell. Fairly easy to do as long as you follow the steps, and about as secure as it gets.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.