I am attempting to automate my Ubuntu 14.04 startup process to save time. I have written a bash script to open all the browser tabs I need when the machine starts. When I execute the commands manually, like:
It works fine and opens a Google Chrome browser window.
However, whenever I try to run one of these commands in a bash script like:
#!/bin/bash gnome-open http://askubuntu.com/
And run the script I'm getting error messages:
sudo browserinit.sh [0823/102740.514014:ERROR:nss_util.cc(94)] Failed to create /home/devel1/.pki/nssdb directory. [0823/102740.514014:ERROR:nss_util.cc(94)] Failed to create /home/devel1/.pki/nssdb directory. --2017-08-23 10:27:40-- https://clients2.google.com/cr/report --2017-08-23 10:27:40-- https://clients2.google.com/cr/report Resolving clients2.google.com (clients2.google.com)... Resolving clients2.google.com (clients2.google.com)... 184.108.40.206, 220.127.116.11, 18.104.22.168, ... Connecting to clients2.google.com (clients2.google.com)|22.214.171.124|:443... 126.96.36.199, 188.8.131.52, 184.108.40.206, ... Connecting to clients2.google.com (clients2.google.com)|220.127.116.11|:443... connected. connected. HTTP request sent, awaiting response... HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] Saving to: ‘/dev/fd/4’ Crash dump id: 2fba097c3e4a2189 0K 1.58M=0s --2017-08-23 10:27:41-- https://clients2.google.com/cr/report
When I use
xdg-open in the script it falls back to Firefox which I don't want to use because it doesn't have some features I need.
gnome-open just doesn't open anything at all.
sudo gnome-open http://askubuntu.com
Gives the same error as the bash script. I have checked and the /home/devel1/.pki/nssdb directory already exists, so I don't know why Google Chrome would be trying to create it again, or why it only does this when performing the command as sudo root.
Any help appreciated. At present bash scripts do not run without sudo, though I may be able to alter permissions for this if someone can tell me a manner of doing this that will definitely alter these only for my local PC and only for the devel1 user.
I do not have true superuser root access to this machine at present.
sudo? Try it without, but the damage may have been already done – browse this site for solutions after starting a gui program with
sudo. Actually you should not launch any GUI applications with elevated privileges. If it does not work without
sudoat all, fix that original problem instead. As a start, get back ownership of all files in your home directory using
sudo chown -R $USER: ~. Then try your stuff again without