How to create a user and limit the user to a directory?
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to create a user and limit the user to a directory?
I've been looking for this feature for months and couldn't find a solution for this. Does anyone know how to create users and limit the user to a specified directory?
I couldn't get into ssh/sftp with the jailed user login. It kicks me out right away. It doesn't even tell me pw is wrong. How would I look into this problem?
Also I've set host.domain.com to a jailed user's html directory, but when I access in my browser, it gives this error: "You don't have permission to access / on this server."
Perhaps there's something I have to enable for the jailed user? httpd perhaps?
Is there an easy way to just creating a jailed directory and create a user/password for it and allow ssh?
Actually, no. This is nontrivial to do properly. Moreover, it introduces risk, because in this scenario chroot generally runs with elevated privileges (and it has a history of vulnerabilities and attack methods).
That said, I thinkopenssh portable has chroot patches written for it (search the 'net). Alternatively, I have been OK with putting shell users in a FreeBSD Jail for the scenario you're describing. This would likely be akin to Linux-VServer for you.
So, again, the short answer is that there is no easy way to do this properly (IMO).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.