Ask coding questions

← Back to all posts
file structure issues
AustinMoore4 (0)

is there any way to block one user from leaving his/her directory? I want one folder for each account, making it easy for security and privacy. can anyone tell me the issue? for instance:
player1 has a folder called /home/runner/Computer/player1.
player1 can access any files in this folder but none else.
player2 has a folder called /home/runner/Computer/player2.
player2 can access any files in this folder but none else.
they should never be able to access the others files. please help if you can

owaso (0)

I don't understand the code much, however I feel as if you could do something like:

input = tkinter.filedialog.askdirectory(NAME DIRECTORIES)
if input = (Directory):
    player = player1
    player = player2

if player = player1:

Sorry if it doesn't make that much sense. I haven't done much with Tkinkter/FileDialog.

Coder100 (16982)

you can't 'protect' a file.
What you should do instead is:

  • have the player log in
  • change files based on the login data of that player
2plus2is4hoi (92)

Well, you could take the input and if the input doesnt contain the folder your in, then dont allow it or something