user not able to launch firefox from unix- X11 error - unix

Using MobaXTerm on RedHat, I am able to launch Firefox from my user profile and access browser GUI. However if I sudo to root and try to launch firefox I get an error:
X11 connection rejected because of wrong authentication.
I want to access CUPS in the browser with root access so that I can administer printers from GUI (not trying to browse as root!). I am aware that all of the administration can be done from command line, but sometimes the GUI is just easier.
How can I resolve this error so that I may launch firefox as root?

Under my user profile where firefox is working, run:
xauth list
The output will be something like:
servername/unix:11 MIT-MAGIC-COOKIE-1 256d99dc3f0f7acdf90190a2710d7042
servername/unix:11 MIT-MAGIC-COOKIE-2 61f888d3342b65f4f05f02fcb708f3d8
servername/unix:11 MIT-MAGIC-COOKIE-3 656d49dc3f0f7acdf96190a2710d7042
Copy the list of these entries.
Then sudo to root and run xauth list again. You will find a different list of cookies.
To repair the trouble, add each of the cookie under my user profile to root's profile via xauth add command:
xauth add servername/unix:11 MIT-MAGIC-COOKIE-1 256d99dc3f0f7acdf90190a2710d7042
As far as I know each cookie needs to be added one at a time, but someone jump in if they know of a bulk method.
After adding the cookies to root profile, Firefox can be launched from root.
Thanks to Byron for the help on this.

Related

Apache Airflow Webserver Log In Failed

I realise this is a duplicate of thousands of posts across the internet, but I have only found solutions for version <2.0, and those solutions do not apply to >2.0.
Basically, I have installed Apache Airflow on an Ubuntu system. Everything installed fine, as far as I see from command line, and I first create a user:
airflow users create --role Admin --username admin --email admin --firstname admin --lastname admin --password admin
And then from here I start up the webserver and scheduler:
airflow webserver -p 8585 > ${AIRFLOW_HOME}/logs/webserver.log 2>&1 &
airflow scheduler > ${AIRFLOW_HOME}/logs/scheduler.log 2>&1 &
And then I can access the webserver via "http://<HOST_IP>:8585" - This loads to the log in screen no problem.
But when I try to log in using the user details initially created, or by using my OS user (on the off-chance), it just fails with "Invalid login." I've tried restarting the webserver and Ubuntu to no avail.
I've used Airflow <2.0 in the past and never even created a user and just logged in straight away, so I'm really blank on what the answer is here. I absolutely hate Airflow and am loosing my mind just trying to log in, so a massive thanks for any help!
Okay, sooo I managed to get it running with login potential. I think I've discovered the issue, at least, and can re-create the problem, though frankly I have ZERO idea why it IS an issue (software coded issue??).
Basically, I had to run the install processes above as ROOT user. I was trying to run it as my admin user, but it kept resulting in the log in issue above - I did notice however that all install guides appear to use the ROOT user, so I gave it a shot in case it was as annoyingly simple as that, and VOILA!! First time logged in.
I did stop the software running at this point, quickly restart it as my admin user and immediately got the same login issue. There's something odd going on here, and I don't know what it is, but when in doubt: Try ROOT.
Solution- Create user again
I ran into the same issue. I had created an Admin user using the same command and after some changes to my config file, I ran airflow db init. After this when I started the webserver, I tried logging in with my admin credentials, but no luck. When I checked the logs, it showed me -
WARNING - No user yet created, use flask fab command to do it.
So I created the user again and it worked.

Why am I being redirected when I launch Jupyter?

When I launch Jupyter with jupyter-notebook I get a redirect screen with the contents
This page should redirect to Jupyter Notebook. If it doesn't, click here to go to Jupyter.
I am then redirected to the Jupyter home screen that I expected to land on in the first place. After that everything seems to work fine.
Why am I being redirected when I launch Jupyter? Is there a way to prevent this from happening?
The page redirection is because of the recent security update to Jupyter notebook in merged pull request #4260: Launch the browser with a redirect file. From now on, the Jupyter will open the file, which will redirect to the browser thus passing the token without putting it in a command-line argument, which may be visible to other users otherwise.
This avoids putting the authentication token into a command-line argument to launch the browser, where it's visible to other users. Filesystem permissions should ensure that only the user who started the notebook can use this route to authenticate.
The new file included in PR is notebook/templates/browser-open.html:
{# This template is not served, but written as a file to open in the browser,
passing the token without putting it in a command-line argument. #}

Qt program ignores KDE theme and qtconfig theme

When I run my Qt5 program as a superuser, the program completely ignores any system fonts, themes and icons and uses some bogus theme. See screenshot.
HOW to fix this programmatically or in any way possible??
It also ignores any KDE configs/qtconfig. This is driving me nuts.
Right is run as normal user, left is run as superuser.
Your config is being saved in your user's home. If you open app as root, it is working with root's settings. Easiest way to fix this would be graphical root login, than change settings to what you want and switch back to regular user. Root graphical login is disabled in most distros but you can still do it by using second terminal.
Press Alt+Ctrl+F2 to open a second terminal.
Login as root (password won't appear).
Type startx and press Enter, the GUI should start automatically.
Go for settings, set whatever theme you want, then log out.
Press Alt+Ctrl+F1 to go back to first terminal.
Everything should look nice from now on.

Firebase: AngularFire Seed won't login

Keeps showing:
Please configure app/js/config.js before running!
I updated my Firebase URL in config.js, enabled email/password and anonymous login in Forge.
Even changed text in the above error msg to:
"TEST Please configure app/js/config.js before running!"
, in app.js -- and my modified text doesn't show up even. Why? I restarted the web server between changes.
node scripts/web-server.js
Crazy, I can't figure this out.
I figured this out. I also had the ZIP archive in my Trash folder on Mac OS, somehow my console was in my Trash path, (no friggin idea how it got there, as I never cd'd to it), hence changes to my main folder weren't getting detected by the web server running on my Trash folder. Stupid user error -)

Hudson trigger builds remotely gives a forbidden 403 error

I have a shell script on the same machine that hudson is deployed on and upon executing it, it calls wget on a hudson build trigger URL. Since its the same machine, I access it as http://localhost:8080/hudson/job/jobname/build?token=sometoken
Typically, this is supposed to trigger a build on the project. But I get a 403 forbidden when I do this. Anybody has any idea why? I have tried this using a browser and it triggers the build, but via the command line it doesn't seem to work. Any ideas?
I figured it out. Apparently if Hudson is protected using a security mechanism, you need to authenticate the build requests. See this wiki link for more details http://wiki.hudson-ci.org/display/HUDSON/Authenticating+scripted+clients
Since I used the auth mechanism that was shipped with Hudson, calling the build scripts invovled. I used
wget --auth-no-challenge --http-user=user --http-password=password http://hudson.yourcompany.com/job/your_job/build?token=TOKEN
to run the build script.
If you use matrix-based security, you can set Job Read and Job Build permission to Anonymous, so you don't need a user and password in your post-commit hook.
Another tip is to turn on polling without setting a date and use this URL:
http://hudson.yourcompany.com/job/your_job/polling?token=TOKEN
Your job will be build just if there were svn changes (no need to build when changing other projects, creating tags etc.)
I got the same errors. In my case I had to add the Jenkins-Crumb header to the HttpPost object to make it work.
post.addHeader("Jenkins-Crumb","crumb value");
To find the crumb value for your Jenkins instance, install Firebug or any plugin n your browser which will help you see the request headers. Go to your job page at http://server_name:port/jenkins/job/job_name
Press F12 to activate Firebug, got to Net tab. Click Enable Auto - refresh link at top right of your page. Now every 5 seconds you should see an Ajax Request being made to fetch the buildHistory. In that request, examine the headers. There should be a header for Jenkins-Crumb, it can also be under name .crumb depending the Jenkins version you are using. You it in your Java code.

Resources