0

I installed MATLAB in /usr/local. Now when I try to launch it normally from dash or by typing matlab in terminal, it starts up and then gives an error that says:

Internal error: No write permission on directory...

But it launches when I run it using sudo. I don't want to run it as root. I give a recursive write permission to .matlab directory with sudo chmod -R 776 /home/uname/.matlab command. Then I tried launch matlab from terminal using command matlab. It terminated with massage :MATLAB is exiting because of fatal error.

Sarath
  • 33
  • 1
  • 1
  • 7
  • Have you checked the ownership and permissions of the directory in question (perhaps `~/.matlab`)? The problem is almost certainly **because** you have run it using `sudo` - see [Why should users never use normal sudo to start graphical applications?](http://askubuntu.com/questions/270006/why-should-users-never-use-normal-sudo-to-start-graphical-applications). – steeldriver Feb 12 '17 at 19:48
  • I launched matlab using the command `sudo -H matlab`. But I could not notice any difference. – Sarath Feb 13 '17 at 12:00
  • Can I create a launcher icon for matlab? – Sarath Feb 13 '17 at 12:09
  • Running with `sudo -H` now won't help: you need to check the ownership and permissions on the directory mentioned in the error message (which you forgot to include): it likely wouldn't hurt to run `sudo chown -R $USER:$USER ~/.matlab` – steeldriver Feb 13 '17 at 14:09
  • I ran `sudo chown -R $USER:$USER ~/.matlab`. But it gives an error: `chown: missing operand after ‘$USER:$USER/.matlab’`. – Sarath Feb 13 '17 at 14:53
  • You need a space between the `$USER:$USER` and the `~/.matlab` - also make sure you include the `~`, if in doubt (or you can't find it on your keyboard) then use `sudo chown -R $USER:$USER $HOME/.matlab` – steeldriver Feb 13 '17 at 14:57
  • Wow, it worked. Thank You @ steeldriver for your valuable advices. – Sarath Feb 13 '17 at 15:08

1 Answers1

1

chmod is just change mode so that you can update your read/write/delete permissions. chown is like a main-gate or encapsulation. Even though, you had

chmod a+rwx <your .matlab folder>/-R

it doesn't launch matlab because you can't reach inside unless you take ownership of that .matlab folder. So,

change the shell as a root, and take ownership as below:

root@upg:~# chown username:groupname <your_matlab_folder>

Ownership is giving system to access (chown is your answer here). Giving read/write/delete actions is using chmod.