Sky*_*ner 11 linux debian passwords tty raspberry-pi
我正在设置一个连接到我的 Linux 机器的远程无线串行终端(如果有人想知道,还有一对 XBees)。一切顺利,但有时按键无法通过。这通常是可以管理的,我会看到它的不足并再次击中它。但是,当我必须尝试几次输入密码时,这很糟糕,因为 Linux 不显示任何内容。我已经将该pwfeedback行添加到我的 sudoers 文件中,但我希望登录提示也显示一些反馈。Linux 机器运行的是 Debian(它实际上是一个管理我大部分家庭网络的树莓派)。
是否可以更改 tty 登录提示以在我输入密码时提供反馈?
取而代之的是:
Raspbian GNU/Linux 7 linuxbox ttyAMA0
linuxbox login: skylarmt
Password:
Run Code Online (Sandbox Code Playgroud)
我想要这个:
Raspbian GNU/Linux 7 linuxbox ttyAMA0
linuxbox login: skylarmt
Password: **********
Run Code Online (Sandbox Code Playgroud)
我不知道有任何配置可以做到这一点,如果你真的想这样做,你可以通过以下方式实现:
1 - 修改 glibc 包中 getpass.c 文件中的 getpass 函数。
2 - 构建 libc-(VERSION).so
3 - 备份原始 lib/(your archcitecture)/libc.so (例如重命名为 libc-(VERSION).so.bak
4 - 将新文件移动到 lib/(your archcitecture) )/ 5 - 运行 ldconfig 来更新缓存
例如,您可以将读取密码的代码替换为如下代码:
/* Read the password. */
// nread = __getline (&buf, &bufsize, in);
int index=0;
char c;
while ( (c=getchar())!= EOF ){
putch('*');
buf[i]=c;
++i;
}
buf[i]='\0';
nread=i;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1177 次 |
| 最近记录: |