core: start guid as normal user even when VM started by root

Another attempt to avoid permissions-related problems...

QubesOS/qubes-issues#1768
This commit is contained in:
Marek Marczykowski-Górecki 2016-06-06 02:21:08 +02:00
parent 89d002a031
commit d0ba43f253
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1758,7 +1758,15 @@ class QubesVm(object):
if verbose: if verbose:
print >> sys.stderr, "--> Starting Qubes GUId..." print >> sys.stderr, "--> Starting Qubes GUId..."
guid_cmd = [system_path["qubes_guid_path"], guid_cmd = []
if os.getuid() == 0:
# try to always have guid running as normal user, otherwise
# clipboard file may be created as root and other permission
# problems
qubes_group = grp.getgrnam('qubes')
guid_cmd = ['runuser', '-u', qubes_group.gr_mem[0], '--']
guid_cmd += [system_path["qubes_guid_path"],
"-d", str(self.xid), "-N", self.name, "-d", str(self.xid), "-N", self.name,
"-c", self.label.color, "-c", self.label.color,
"-i", self.label.icon_path, "-i", self.label.icon_path,