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:

gnome-open https://askubuntu.com


xdg-open http://askubuntu.com/

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:

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)...,,, ...
Connecting to clients2.google.com (clients2.google.com)||:443...,,, ...
Connecting to clients2.google.com (clients2.google.com)||:443... 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.

  • 3
    Why do you start it with sudo? Try it without, but the damage may have been already done – browse this site for solutions after starting a gui program with sudo then.
    – dessert
    Aug 23, 2017 at 9:59
  • I can't run bash scripts without sudo, as noted in the question. Please specify what could possibly be 'damaged'. Aug 23, 2017 at 10:00
  • NEVER launch browsers and other similarly exposed and potentially dangerous applications with sudo. Actually you should not launch any GUI applications with elevated privileges. If it does not work without sudo at 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 sudo.
    – Byte Commander
    Aug 23, 2017 at 10:01
  • 1
    Could someone explain to me why this is a problem? It will potentially be important. Also, how should I best launch a bash script without sudo privileges? Aug 23, 2017 at 10:02
  • @PeterCarter The rights of your config files are changed, that's what's damaged.
    – dessert
    Aug 23, 2017 at 10:02

1 Answer 1


You start a script with the full path or the relative path.

Full path would be for you:


Relative would be depending from where you want to start, assuming you are in the directory of the script:


Like others said, do not run a browser ever as root since that allows any script run inside a website you open to alter your whole filesystem if it wishes to do so. It's just not secure. Also it destroys your home files permissions, which makes them not accessible without root rights anymore, since everything newly created will now be owned by root.

Like I wrote in the comment section. As soon you have "sudo" rights you DO have true root access.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .