Sunday, May 5, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 2239  / 2 Years ago, wed, january 19, 2022, 7:35:52

How can I get the following command to change for the root user as well?



gsettings set org.gnome.gedit.preferences.editor create-backup-copy false


This command should disable gedit backup files. It seems to work for the current user "vagrant" as shown in the screenshot below, but not root.



enter image description here



It is important to mention that this command needs to be run as the current user "vagrant" as it is part of a script.



Ubuntu 12.04
Kernel 3.2.0-58-generic-pae
GNOME 3.2.1
Running Linux in a Vagrant VM on Windows 8 using Virtual Box

More From » command-line

 Answers
5
sudo -i


This worked!



If you are confident that the current user has the appropriate privileges to sudo, then the following command will change the root users gedit preferences from the current user



sudo -i gsettings set org.gnome.gedit.preferences.editor create-backup-copy false


However, instead of disabling the backup files at all, you could relocate them to another folder. Rmano provided the following script:



mkdir ~/TILDEBACKUPS



#!/bin/bash

find $HOME/* -name TILDEBACKUPS -prune -or -name "*~" -print -exec mv {} $HOME/TILDEBACKUPS/ ;


Also, as pointed out by Rinzwind, scripting gsettings may require a lot of maintenance as schema names change.



Finally, there was a bigger mistake here that led me to even asking this question. Thanks to Radu Rădeanu, opening the file with "sudo gedit filename" will cause all sorts of issues discussed in Why user should never use normal sudo to start graphical application



A better way to open filename in gedit is:



gksudo gedit filename


Thank you for everyone's help


[#27114] Thursday, January 20, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ainsbeave

Total Points: 280
Total Questions: 98
Total Answers: 105

Location: Faroe Islands
Member since Sat, Aug 20, 2022
2 Years ago
;