如何使用sshd_config-PermitUserEnvironment选项


11

我有,client1而且client2都是Linux机器。来自client1

client1$ssh root@client2 "env"

它显示来自的ssh变量列表client2

我所做的事情client2

我想向client2添加新变量。所以我编辑sshd_config

PermitUserEnvironment yes

并在ssh下创建了一个文件环境,其内容如下

Hi=Hello

然后重新启动sshd

/etc/init.d/sshd

现在从client1尝试相同的命令

client1$ssh root@client2 "env"

没有提供新的变量Hi

参考:


1
完成。“环境”文件应该在〜/ .ssh下,而不是在/ etc / ssh下。它工作正常。希望这个人。

1
/etc/ssh/environment知道,但/etc/environment应该工作(至少它为我)。
ℝaphink

Answers:


3

并在ssh下创建了一个文件环境,其输入为Hi = Hello

假设/ root是root的主目录,则应该在client2上创建文件/root/.ssh/environment。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.