Dropbox asks Authentication is needed to run `/usr/sh' as the super user

Solution 1:

Answer

If Dropbox finds files in its folder that aren't owned by your user, it will try to run a script with super user privileges to change the ownership of those files to your user.

If you click Cancel, Dropbox won't run the script but you'll continue to get the popup because it will continue to detect the problem.

If you're able to confirm it is Dropbox causing the popup, then the solution is to enter your credentials and let it run the script (more details below).

Alternatively, to be safe you can make the changes yourself; see Pablo Bianchi's answer.

Details

I just got this same popup, but not at login:

enter image description here

I expanded Details and then I searched the web for org.freedesktop.policykit.exec which pointed me to pkexec.

Looking through my processes for pkexec, I found:

$ ps -ef | grep [p]kexec
root     11040 26447  0 14:16 ?        00:00:00 pkexec /bin/sh /tmp/tmp5vgk_93m

So of course I was curious what that file was doing:

$ cat /tmp/tmp5vgk_93m
#!/bin/bash
chown -h -R 1234 "/home/user/Dropbox"
chmod  -R u+rwX "/home/user/Dropbox"

It looks like Dropbox must have detected that there are some files in my Dropbox folder that aren't owned by my current user.

I used find to confirm:

$ find ~/Dropbox/ ! -user $USER
/home/user/Dropbox/Projects/picodrive/cpu/fame/famec.o
/home/user/Dropbox/Projects/picodrive/cpu/drc/cmn.o
/home/user/Dropbox/Projects/picodrive/cpu/cz80/cz80.o
...

Sure enough, looks like some of the files aren't owned by my user:

$ ls -l /home/user/Dropbox/Projects/picodrive/cpu/fame/famec.o
-rw-r--r-- 1 root root 1346564 Dec 18 13:33 /home/user/Dropbox/Projects/picodrive/cpu/fame/famec.o

In theory Dropbox shouldn't have any problem syncing that file since it's world-readable, but at least what they're doing makes sense.

I also noticed that while Dropbox was syncing I saw errors like this, which seems to be an additional confirmation:

Can't sync "famec.o" (access denied)

Last but not least, I'm going to put this here because I had trouble searching the web for this problem:

Authentication is needed to run `/bin/sh' as the super user

Solution 2:

For some reason

chmod 755 ~/Dropbox

fixed the problem for me. I recall that I've recently moved my Dropbox folder from NTFS partition symlinked in my home folder to physically be in my home folder - and probably didn't set the permissions after it.

Solution 3:

Dropbox may not be able to read the files for various reasons, like ownership, permission bits or broken links. I would assume you are using current normal user.

  • Find files not owned by current user

    find ~/Dropbox/ ! -user $USER
    
  • Change ownership and group of those files

    find ~/Dropbox/ ! -user $USER -exec sudo chown $USER:$USER "{}" + –
    
  • Find files not readable with current user

    find ~/Dropbox/ ! -readable -ls # -delete to remove them
    

IMO this is a security issue on Gnome.