View Issue Details

IDProjectCategoryView StatusLast Update
0007136Kali Linux[All Projects] Feature Requestspublic2021-09-08 13:39
ReporterLeeRock Assigned Todaniruiz  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionreopened 
Product Versionkali-dev 
Target VersionFixed in Version2021.3 
Summary0007136: Unable to start web browser from the command line when running as root.
DescriptionThis has always been an option until recently.
When running as root, there should be NO restrictions.

Activities

Michu

2021-04-10 16:22

reporter   ~0014447

maybe sandbox is blocking her what's the browser ?

LeeRock

2021-07-05 22:36

reporter   ~0014885

Here is an example how I would automate opening the default web browser with multiple tabs, each tab containing a different URL that was read in via a list.

for i in $(cat list.txt ); do
     firefox -new-tab https://$i &
     sleep 1
done

daniruiz

2021-08-25 08:21

manager   ~0015027

This is fixed now. With kali-themes 2021.4
You need to remove /root/.config after updating too, to remove previous settings

LeeRock

2021-08-25 17:12

reporter   ~0015029

This does not fix the issue.

root@kali:~# firefox-esr
Running Firefox as root in a regular user's session is not supported. ($XAUTHORITY is /home/kali/.Xauthority which is owned by kali.)
         

daniruiz

2021-08-26 15:27

manager   ~0015031

Hello again.
Sorry, I didn't explain it properly as I thought this issue was not about running the command firefox as root but about opening links from a root program. In any case both are solved as explained below

The issue with firefox can't be "directly" fixed. Firefox does not allow running it as root if your session is run by a regular user, that has been like that for a while. That's why in old versions of kali you could open firefox as root, because you were using the root user for the whole session, not only firefox.

Now the solution:
What you need to do is open firefox as the user owner of the $XAUTHORITY file:

root@kali:/# USER=$(find $XAUTHORITY -printf '%u')
root@kali:/# runuser -u $USER -- x-www-browser https://kali.org

Now, this is already fixed with the update of kali, as we've added this script to a new helper app called 'Default Browser' and now it is configured as the default browser for all desktops. This way, no matter if you are running a program as root or as a regular user, when you click/open a link from the app, this helper app will ensure the browser (in this case firefox) is run as the current logged user.
So now with this fix, a simpler way to open a link from the terminal would be:
root@kali:/# xdg-open https://kali.org

To make this update work you need kali-themes 2021.3 (sudo apt update && sudo apt install kali-themes)

LeeRock

2021-08-27 13:59

reporter   ~0015046

This change has caused another issue.
While running as root, you are now unable to to open a local .htm file using these methods:

1. xdg-open index.htm
2. Paste the following into an open browser: file:///root/index.htm
2. From an open browser > ctrl + O > Filesystem > root > Open
          Could not read the content as root.
          Error opening directory '/root/': Permission denied

daniruiz

2021-08-28 09:25

manager   ~0015051

If you are not running as root, why are you using everything as root?
You can't access root's files with a regular user, that is normal. You can change the permissions of the files so that your user's browser can open them. Or just, move to the root user for everything.

Issue History

Date Modified Username Field Change
2021-04-07 19:13 LeeRock New Issue
2021-04-10 16:22 Michu Note Added: 0014447
2021-06-30 08:49 g0tmi1k Priority urgent => normal
2021-07-05 22:36 LeeRock Note Added: 0014885
2021-07-08 22:45 Gamb1t Assigned To => daniruiz
2021-07-08 22:45 Gamb1t Status new => assigned
2021-08-25 08:21 daniruiz Note Added: 0015027
2021-08-25 08:21 daniruiz Status assigned => resolved
2021-08-25 08:21 daniruiz Resolution open => fixed
2021-08-25 08:21 daniruiz Fixed in Version => 2021.3
2021-08-25 17:12 LeeRock Status resolved => feedback
2021-08-25 17:12 LeeRock Resolution fixed => reopened
2021-08-25 17:12 LeeRock Note Added: 0015029
2021-08-26 15:27 daniruiz Note Added: 0015031
2021-08-26 22:55 LeeRock Status feedback => assigned
2021-08-27 07:32 daniruiz Status assigned => resolved
2021-08-27 13:59 LeeRock Status resolved => feedback
2021-08-27 13:59 LeeRock Note Added: 0015046
2021-08-28 09:25 daniruiz Note Added: 0015051
2021-09-08 13:39 daniruiz Status feedback => closed