Digital Recipe
암호 입력 시 피드백 받기 본문
리눅스에서 'sudo'로 커맨드를 실행시키고 암호화를 입력 받을 때 암호 입력에 대한 피드백을 받기 어렵다. 이를 해결하기 위한 리눅스 환경설정이다.
출처 : http://lifehacker.com/make-password-asterisks-visible-in-your-linux-terminal-1183533223
Make Password Asterisks Visible in Your Mac or Linux Terminal
When you run a command with sudo
in Linux, the terminal prompts you to type in your password—and doesn't give you any visual feedback. Here's a quick tweak that'll bring back those familiar asterisks (*) when you type in your password.
I'm a fast typer, so when I mess up my password, I have to start over from scratch. With asterisks, it's a lot easier—and seeing as no one's looking over my shoulder in my home office, it doesn't matter how obscured my password is. To bring back those asterisks:
- Run the following command in a Terminal:
sudo visudo
- Scroll down to the line that looks like this (note that Mac users may have to learn a few vi commands):
Defaults env_reset
- and change it to this:
Defaults env_reset,pwfeedback
- Press Ctrl+X to finish editing, Y to save changes, and Enter to exit if you're on Ubuntu. Other Linux distros may have different commands depending on the default editor. Mac users, for example, use vi, and will have to type
:wq
and press Enter to exit).
Now, when you run a command with sudo, you should get visual feedback when you type in your password. This should work in all versions of Ubuntu after version 10.04, as well as many other versions of Linux. We also tested it on a Mac running OS X 10.8 Mountain Lion. Check out the link below for more ways to tweak how sudo works.