11

I am setting up a long-range wireless serial terminal (with a pair of XBees, if anyone is wondering) connected to my Linux box. It's going great, but sometimes a keystroke doesn't go through. This is usually manageable, I'll see the lack of it and hit it again. However, it's bad when I have to try a few times to type my password because Linux doesn't show anything. I've already added the pwfeedback line to my sudoers file, but I'd like the login prompt to show some feedback as well. The Linux machine is running Debian (it's actually a raspberry pi that manages most of my home network).

Is it possible to change the tty login prompt to give feedback as I type my password?


Instead of this:

Raspbian GNU/Linux 7 linuxbox ttyAMA0

linuxbox login: skylarmt
Password:

I would like this:

Raspbian GNU/Linux 7 linuxbox ttyAMA0

linuxbox login: skylarmt
Password: **********
  • see this answer : unix.stackexchange.com/a/141272/27616 – Olivier Dulac Jan 21 '16 at 11:56
  • I don't think such a change is currently possible on config level. Terminal login is managed by agetty which invokes /bin/login for password prompt. You could achieve described effect by changing properly login source code, recompile it and use modified version, but this requires some ANSI C knowledge. – DevilaN Apr 6 '16 at 9:22
1

I am not aware of any configuration to do this, if you REALLY want to do it you can achieve this by :
1 - modifying the getpass function in the getpass.c file in the glibc package.
2 - build libc-(VERSION).so
3 - backup the original lib/(your archcitecture)/libc.so ( say rename to libc-(VERSION).so.bak
4 - move the new file to lib/(your archcitecture)/ 5 - run ldconfig to update the cache
As an example you can replace the code that reads the password with a code that can look like this:

  /* 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;

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.