Skip to content

How to prevent access to everything in a directory to everything except a couple of programs?

I have my own user account on Linux (arch) I am logged in as. Currently all files in my home directory are owned by me. But how can I set everything in a particular directory within the home directory to be accessed only by a couple of programs rather than all the programs I use?

This is to prevent a malicious program from altering or viewing the contents of those files.

I tried using firejail but it's not what I'm looking for. First of all it doesn't have a global disable policy where you block everything then only allow what you want. Second of all you need to be sure every application is opened using firejail if you want to be fully secure.

Instead I want to do something like saying only nvim and vscode can alter or view anything in this particular directory. What is the recommended way to do this? I've never really done anything with users and permissions other than the defaults but I'm assuming this is the way to go?

13 points7 comments
Open on Reddit
About this post
Posted
Archived
Score
13 · 94% up
Kind
Text
ID
nv4tzx

Author

109
posts
183
comments
0
media
View profile
No comments archived yet. Reddit counts 7.

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.