Iam trying to make a password manager with login system using python and tkinter. To store those passwords I'm using notepad. But, the problem is that, the passwords are easily accessible just by opening the .txt file(without logging into the app) that I'm using to store them.So, is there any way to make those text files only accessible through that app or any better way to store that information? Please dont mind any mistakes
There are some issues with the way you're going about doing this.
First, you shouldn't be storing actual passwords. Instead, hash them and store the hashes, then when your users try to log in, you hash the passwords they give and check that it matches the hash you have stored for them.
Second, your app should be running under a service account and whatever secrets it needs should be accessible only to that account, which prevents any other user from being able to read its sensitive data. For added protection, you can disable ssh and shell access for that service account, and also disable sudo and root logins on your server to make it a bit harder for an attacker to become the service account (be aware it doesn't make it impossible, just harder).
Third, you shouldn't be rolling your own secrets manager anyway. But assuming this is some sort of toy app or school project where you're doing it to learn how to do it, keep some basic rules of info sec in mind. You can also encrypt the file you keep the password hashes in, but don't think that necessarily buys more security as anyone who can get access to your service account to read the password file at all can also get the encryption key. This is the basic reason /etc/passwd and /etc/shadow aren't encrypted and are instead protected by restrictive file permissions.
Mind you, a user database in a flat text file isn't particularly scalable, so while it works fine for servers, apps with a lot of accounts tend to use real databases, and you can use the database manager's built-in access control and encryption functionality to restrict access to sensitive tables and encrypt sensitive columns.
Suggestions regarding accessiblity of files in python