Debian – How to encrypt/hide password in /etc/network/interfaces file on debian

debianencryptionnetworkingpasswordwlan

How can I encrypt/hide my – wpa-psk "password" – line in the /etc/network/interfaces file? Since it's uncovered and readable for everyone who can get in the file now.

Or is it better that I use something else if I don't want to store my blank wifi password in a file?

I'm running on debian without desktop environment.

Best Answer

The best you can do is hash the password. Set wpa-psk to the output of:

wpa_passphrase <SSID> <KEY>

This will obfuscate the password, but it will not prevent someone else from using the hash to connect with another device.

As an additional measure you should also set /etc/network/interfaces file permission to rw------- (600), chmod og-rw.