Is there a new way to launch nautilus from a basic script?
#!/bin/bash
echo "Open File Manager as Root"
sudo nautilus
Opening from Nautilus scripts context menu does not launch Nautilus if sudo is present (opens Nautilus from the scripts context menu if sudo is removed), however, his opens Nautilus with password prompt if run as a program.
Tried:
nautilus admin:///home/
Tried this, but does not work for me, just generates an error when Nautilus launches. Policykit1 error, does not have a uid set
Suggestions here but none of this works, or the answer is unclear and I am missing something.
Note:
When trying to launch any script with sudo in from the Nautilus script menu, none of these scripts will launch.
Tried:
sudo apt-get install nautilus-admin
This did not work, Policykit1 error
Found this here that got Open as Administrator to work here
sudo add-apt-repository ppa:ubuntuhandbook1/gvfs
sudo apt install gvfs-fuse
sudo apt install gvfs
Reboot
How to Restore GVfs to stock version:
sudo apt install ppa-purge && sudo ppa-purge ppa:ubuntuhandbook1/gvfs
I found that this worked for me:
#!/bin/bash
gnome-terminal -- sh -c 'echo "sudo nautilus" | bash'
Now when I use the Nautilus script menu I can launch a root Nautilus session.
This also worked as suggested below:
#!/bin/bash
pkexec env DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" nautilus