<p>I've had a FTP server (Mac OS X, but not the server version) set up for a while where the users are virtual, i.e. they are not actual user accounts in the server's OS, but accounts handled by the FTP server software -- to the OS they all look like the <code>ftp</code> user account. I'd like to retire the FTP server software and go SFTP instead.</p>

<p>Is there a way to set up SFTP/SSH so that I can create virtual users and at the same time sandbox them?</p>

<p>The reason I want virtual users is because I add and remove accounts from time to time, and doing that with proper user accounts tend to get messy, and I don't know of a good way to sandbox them. There's always some files left and each user has their own user directory (with a lot of files only relevant if they would actually log on to the machine when sitting in front of it), which is quarantined when the account is removed, so you have to remove it by hand yourself, and so on.</p>

[{'answer_id': 39189, 'author': 'robc', 'author_id': 3979, 'author_profile': 'https://Stackoverflow.com/users/3979', 'pm_score': 3, 'selected': False, 'text': '<p>The usual generic Unix answer to this is \'PAM\'. If you want plain old OpenSSH SSHD to handle your SFTP, you need something plugged in to SSHD\'s PAM stack (/etc/pam.d/sshd) that does what you need and leaves out what you don\'t need. This might be a general-purpose directory server (probably LDAP) that maps all your virtual users to one home directory and gives them a restricted or scponly kind of shell.</p>\n\n<p>If you want to look at FTP servers that can also do FTP-ssl (which is not the same as SFTP),  good ftp servers like Pure-ftpd or vsftp will do that.  FTP-ssl servers have simpler virtual user support.</p>\n\n<p><a href="http://www.bsdguides.org/guides/freebsd/networking/pure-ftpd_virtual_users.php" rel="nofollow noreferrer">http://www.bsdguides.org/guides/freebsd/networking/pure-ftpd_virtual_users.php</a></p>\n'}, {'answer_id': 4356859, 'author': 'Jason Buberel', 'author_id': 202275, 'author_profile': 'https://Stackoverflow.com/users/202275', 'pm_score': 0, 'selected': False, 'text': '<p>If you\'re open to commercial products, VShell Server from Van Dyke Software is available on Unix/Linux/Windows, supports virtual users (multiple backends) with SSH and SFTP protocols:</p>\n\n<p><a href="http://www.vandyke.com/products/vshell/index.html" rel="nofollow">VShell Server</a></p>\n'}, {'answer_id': 5018710, 'author': 'JDS', 'author_id': 391851, 'author_profile': 'https://Stackoverflow.com/users/391851', 'pm_score': 0, 'selected': False, 'text': '<p>JSCAPE SFTP Server is a commercial, cross-platform server that does what you want.</p>\n\n<p><a href="http://www.jscape.com/" rel="nofollow">http://www.jscape.com/</a></p>\n\n<p>I know, sounds like I work for them, but I don\'t :)</p>\n'}, {'answer_id': 73743184, 'author': 'rumpelsepp', 'author_id': 2587286, 'author_profile': 'https://Stackoverflow.com/users/2587286', 'pm_score': 0, 'selected': False, 'text': '<p>There is <a href="https://github.com/drakkan/sftpgo" rel="nofollow noreferrer">sftpgo</a> which supports virtual users and <a href="https://github.com/drakkan/sftpgo#features" rel="nofollow noreferrer">much more</a>.</p>\n'}]
['https://Stackoverflow.com/questions/39135', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1109/']