[Solved] The domain user usually deletes applications accidentally in the desktop!

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
ruyzz

[Solved] The domain user usually deletes applications accidentally in the desktop!

Post by ruyzz »

Hello

I want to block applications .desktop, the domain user usually deletes applications accidentally.

It can be done manually with the terminal Ctrl + Alt + T:

Chttr + i /home/domain/user/desktop/*.desktop

But the PC, is used by "n" users.

Is there any way to do it automatically with an .sh file?

Greetings.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: The domain user usually deletes applications accidentally in the desktop!

Post by catweazel »

ruyzz wrote: Wed May 02, 2018 12:33 am Is there any way to do it automatically with an .sh file?
You can try adding the command to rc.local.

Code: Select all

sudo nano /etc/rc.local
Add the command in there before the line that reads exit 0.

ctrl-o <enter> to save, ctrl-x to exit, followed by:

Code: Select all

sudo chmod +x /etc/rc.local
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: The domain user usually deletes applications accidentally in the desktop!

Post by rene »

ruyzz wrote: Wed May 02, 2018 12:33 am Chttr + i /home/domain/user/desktop/*.desktop

[ ... ]

Is there any way to do it automatically with an .sh file?
No need for a script: simply sudo chattr +i /home/domain/*/Desktop/*.desktop would work.
ruyzz

Re: The domain user usually deletes applications accidentally in the desktop!

Post by ruyzz »

Hello rene:

It only works when users are created, not when a new one is created when joining the domain.

There is a way to make it dynamic!
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: The domain user usually deletes applications accidentally in the desktop!

Post by rene »

Wasn't clear to me what the question entailed; the above reply would however still seem to to be the "Scripts & Bash" part of it? I take it now that you need some sort of trigger upon joining a domain: believe you may need to repost that part in the networking section. Personally precious little clue about Windows networking (and I do mean "precious").
ruyzz

Re: The domain user usually deletes applications accidentally in the desktop!

Post by ruyzz »

Thanks catweazel is the solution!

There will be some way to make it work when you start the session.
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: The domain user usually deletes applications accidentally in the desktop!

Post by rene »

Extremely misty thread. Only responded since I failed to notice a connection between the question and catweazel's reply -- and still do in fact. Shall however assume that "the solution" will indeed have some connection to "the question" though and thank you for reporting said solution :?
ruyzz

Re: The domain user usually deletes applications accidentally in the desktop!

Post by ruyzz »

Hello:

This I wrote in the rc.local file:

chattr + i /home/domain/*/Desktop/*.desktop

exit 0
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: The domain user usually deletes applications accidentally in the desktop!

Post by catweazel »

ruyzz wrote: Fri May 04, 2018 10:26 am Thanks catweazel
You're most welcome.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
Locked

Return to “Scripts & Bash”