大网数据广告活动
服务器运维问答

Linux user without any filesystem permissions

· 52CE 我爱测

I need to make a linux user for the sole purpose of an SSH proxy. Amongst other things, the user should not be able to go around exploring the filesystem or even access a shell really. Obviously I could just chmod remove all read…

问题原文

原帖链接 · Alex · CC BY-SA 3.0

I need to make a linux user for the sole purpose of an SSH proxy. Amongst other things, the user should not be able to go around exploring the filesystem or even access a shell really.

Obviously I could just chmod remove all read/write/execute permissions for everything, but that's obviously a pretty bad and potentially time consuming option.

The only connection using this user should be via ssh -D [email omitted]

I'm running Debian 7.

社区高分解答

原帖链接 · MadHatter · CC BY-SA 3.0

If the user is going to log in, they're going to have to be able to read some bits of the file system. You simply can't launch an interactive shell without access to certain files.

If all they need to do is authenticate far enough to tunnel other connections (including, as in this case, taking advantage of the ssh SOCKS proxying facility), it's better to deny the user an interactive shell (eg, usermod -s /sbin/nologin account), then have them authenticate without interaction (ssh -N -D 23456 [email omitted]).

Don't forget that ssh -D requires a port number to bind the local SOCKS proxy to, so the example in your question is syntactically invalid.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-07-18)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。