Run as administrator and sudo are different

Bug #1469122 reported by pafosdfkapos on 2015-06-26
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Files
Fix Committed
Low
Jeremy Wootten

Bug Description

If i right click on the Files and run it as an administrator from the Plank and when I use sudo pantheon-files, the results are not the same. Is it supposed to be like this?

Related branches

Jeremy Wootten (jeremywootten) wrote :

When run from terminal the sidebar shows the current user's bookmarks but when run from Plank the sidebar shows only Home and Rubbish bookmarks. Not sure whether this is a problem with Files or Plank but I do not think it should be like this.

Changed in pantheon-files:
status: New → Confirmed
Jeremy Wootten (jeremywootten) wrote :

On investigation, the cause of this is that Files is launched from Plank using "pkexec" which resets the environment, not sudo. Unfortunately FIles crashes after the authentication dialog if this is simply changed to gksudo --preserve-env

Jeremy Wootten (jeremywootten) wrote :

The simplest fix to this would be to show the root bookmarks in both cases.

pafosdfkapos (pafosdfkapos) wrote :

The simplest method is always not the best one, I think that the users' bookmarks should be displayed in both cases, IF there is only one user.
If there are multiple accounts, maybe then only show the bookmarks of the root.

Daniel Fore (danrabbit) wrote :

Launching apps with gksudo is deprecated. Running the app complete as root (sudo) is not recommended as it is not as safe as pkexec.

Policykit (pkexec) is the recommended method for escalating privileges. From the pkexec docs "The environment that PROGRAM will run it, will be set to a minimal known and safe environment in order to avoid injecting code through LD_LIBRARY_PATH or similar mechanisms. In addition the PKEXEC_UID environment variable is set to the user id of the process invoking pkexec"

Changed in pantheon-files:
status: Confirmed → In Progress
assignee: nobody → Jeremy Wootten (jeremywootten)
importance: Undecided → Low
Daniel Fore (danrabbit) on 2015-09-18
Changed in pantheon-files:
milestone: none → loki-beta1
Changed in pantheon-files:
status: In Progress → Confirmed
assignee: Jeremy Wootten (jeremywootten) → nobody
Cody Garver (codygarver) on 2016-03-14
Changed in pantheon-files:
milestone: loki-beta1 → loki+1-beta1
Changed in pantheon-files:
status: Confirmed → In Progress
assignee: nobody → Jeremy Wootten (jeremywootten)
Daniel Fore (danrabbit) on 2017-06-05
Changed in pantheon-files:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers