Is there a way to make a file unchangeable even with sudo rights in linux?
i am porn addicted to i blocked by 85000+ porn sites via the host file ( /etc/hosts )
The Problem is that i can just change the file and watch porn again.
Is there any way to prevent this?
I was thinking of writting a script that overwrites the file every 3 seconds so every change will be ignored, but i have no idea how to practically do this
Anyone got ideas?
From my experience even if you found a way to do this it won't help you. In the end the only way to truly beat an addiction is self-control. Anything else is just temporary. You will eventually give in and simply reinstall your OS to fap. Or you'll use your phone.
>Or you'll use your phone.
i already sucessfully a way to block all porn on my phone and never watched porn on my phone ever since again
Because you watch it on a bigger, better screen.
fpbp
yeah big agree. OP you gotta wrestle with your demons, you're not so weak that trying to lock them away is your only solution. Find strength in god
Just delete your sudoers file in /etc/sudoers
youre welcome bb 😉
I don't think that you're asking is possible. The superuser can only slow down their own actions, not really prohibit them. Any mechanism to prevent modification can be dismantled by the superuser.
I guess what you could do is generate a random throwaway password for root and remove any sudo privileges from yourself. That way you can't sudo into root and you can't login as root.
Of course you would have prevent a single user mode, so that would have to make a other throwaway password to prevent that as well.
As for the updating hosts file, you would have to make cron script that runs every 3 second to replace the host file with intended one. Has to be run as root as to prevent dismantling this step.
Then again, you could just reinstall the computer entirely...
Just have to work on self-control. Why do you gravitate to porn? boredom? You'll have to find another activity to replace the porn sessions.
>Is there a way to make a file unchangeable even with sudo rights in linux?
Yea. You remove specific sudo priv to that file or makes its permissions only accessible by another user. Like user account you throw away the password for.
Yes
Mount it from a physically RO locked SD Card (just break off the switch so that you won't be able to make it writable again)
this has to be the smartest post i have seen here in a long time. Like ChatGPT couldn't have come up with this (to dumbed down and pussy).
I will have to read more into mounting of file systems and changing existing file systems used by the system but this might actually work
just make a symlink from /etc/hosts to wherever you've mounted it
chattr +i /etc/hosts && rm -f $(which chattr)
this won't stop your porn addiction
the problem is, you have a void in your life that you're filling with porn, the moment you find something better to do and spend time on, you won't have to divert your attention towards porn
instead of coming up with convoluted and easily bypassable solutions, find something better to do
I fap because I'm lonely. I'm lonely because I fap. What do?
Fuck men. I'm being serious.
run rm -rf /
>can't change the file when there is no file
high iq
>no hosts file to edit
>no browser to view porn on
>>no hosts file to edit
>>no browser to view porn on
heh
Use an SELinux policy
https://www.apriorit.com/dev-blog/cybersecurity-managing-file-access-with-selinux
You'll forget how you did it and won't be able to change the file. Or you'll become an SELinux competent admin.
If you used an sdcard you could just remove the SD card and the hosts file would be gone, defeating your blacklist.
Literally just stop looking at porn, if you're truly incapable of doing that then cut your power cables so you can't use the internet until you learn some self control
+ porn sites via the host file ( /etc/hosts )
Can I have a copy of that file?
what for?
just give us the fuckin file
i want a fuckin square wave
i'm on no fap november and still going. i deleted league of legends a couple days ago. lets see how it goes
Did you jerk off to League?
no!! thats funny but its two separate addictions i think they add subliminal shit to league of legends for real dawg
I once went 2 months without fapping because no new e-boi hentai doujins came out
And I only fap to e-boi hentai
If you had any taste you wouldn't get addicted to things in the first place.
The bottom line is that you cannot outsmart yourself. It's like trying to determine a winner when you're playing yourself in chess. Addict you is much more resilient than non-addict you. Trust me, if you're smart enough to put technical barriers between you and porn you're smart enough to overcome them when you feel like it.
can you just give us line number 54,383
make a new user and chown it or even better chown and chmod