Ask coding questions

← Back to all posts
password protect a folder
AustinMoore4 (0)

is there a way to protect a folder so that others cant get into it. please do this in python.

Comments
hotnewtop
IcynDevz (725)

Use .env files. Read the docs the for more information.

Coder100 (16795)

simple answer: you can't.
long answer: technically you can prevent people from seeing certain things, like secrets using .env

read: https://docs.repl.it/repls/secret-keys

SameeraMurthy (110)

You can't password protect a folder in a repl. If your are looking to store credentials, you can make a .env file to store your credentials in instead. (.env files are automatically protected and private.)

SixBeeps (5037)

What kind of functionality do you want out of this folder?
Do you want read/write access while the folder is locked, or does it not matter?
Also, this is more of an OS question rather than a coding question. Replit runs on Ubuntu, so maybe do some research into password-protected folders on Ubuntu.

AustinMoore4 (0)

@SixBeeps the folder should be readable to the account that owns that folder. if someone trys to open the folder in another account it should error( not the program)