本文介绍了将 linux 用户限制到一个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为一个用户创建一个单独的文件夹,他只能在其中执行一个二进制文件.他也可以调用 python/perl 并运行程序.但是用户不应该能够删除其目录中的任何文件夹,也不应该能够查看任何其他目录.我怎样才能做到这一点?

I need to create a seperate folder for an user where he is allowed to execute only one binary. He can call python/perl and run a program also.But the user should not be able to delete any folder in his directory and should not be able to view any other directory. How can i achieve this ?

推荐答案

如果他们只能通过 ssh 访问,那么 ChrootDirectory 是最佳选择.简而言之,您在另一个目录中创建了一个伪造的 / 系统,其中包含允许用户运行的所有程序 &他们需要的图书馆.

If they are accessing only over ssh, then a ChrootDirectory is the way to go.Simply put, you create a fake / system in another directory, with all the programs the user is allowed to run & the libraries they need.

请参阅 sshd_config 手册页的 ChrootDirectory 部分,或类似 此处 如果需要更完整的指南.

See the ChrootDirectory section of the sshd_config man page, or somewhere like Here for a fuller guide if needed.

这篇关于将 linux 用户限制到一个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 22:39