由于各种原因,我需要启用 telnet 访问(通过专用网络),并且当有人尝试使用特定用户帐户登录时(可以说CheckStatus
),它不是给用户一个 shell,而是运行一些非常非常快的代码/ script/whatever 并返回两个非常具体的字符串之一。该帐户可以有密码。
我本质上是在尝试复制当您尝试通过 SSH 连接到 Github 的服务器时发生的情况,它们告诉您未授予 shell 访问权限。
我认为解决这个问题的方法是替换用户的 shell,所以我创建了脚本:
#! /bin/bash
echo "HI!!!"
Run Code Online (Sandbox Code Playgroud)
然后尝试通过以下方式将其设置为用户的外壳:
test@development-1:~$ chmod +x test.sh
test@development-1:~$ chsh
Password:
Changing the login shell for test
Enter the new value, or press ENTER for the default
Login Shell [/bin/bash]: /home/test/test.sh
chsh: /home/test/test.sh is an invalid shell
Run Code Online (Sandbox Code Playgroud)
关于最好的方法有什么想法吗?
作为参考,我们的大多数系统都是 Ubuntu 14.04。