[英]Python Keyring ,how to pass master password
Is there any way to pass master password automatically/programmatically. 有没有办法自动/编程传递主密码。 as per the below code we have to input password manually, can we avoid this 根据以下代码我们必须手动输入密码,我们可以避免这种情况
import keyring
keyring.set_password('testuser','testuser','testpassword')
test = keyring.get_password('testuser', 'testuser')
print(test)
If this is your personal computer then I would suggest that you store your master password in a secure location like /etc
. 如果这是您的个人计算机,那么我建议您将主密码存储在像/etc
这样的安全位置。 For linux you can create a file like /etc/master_passwd.txt
and store password in it (run the below command with sudo). 对于linux,您可以创建一个像/etc/master_passwd.txt
这样的文件并在其中存储密码(使用sudo运行以下命令)。
$ touch /etc/master_passwd.txt > your_password_here
Then in your python script you can get master password with: 然后在你的python脚本中你可以获得主密码:
with open('/etc/master_passwd.txt', 'r') as passwd_file:
master_password = passwd_file.read()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.