Ubuntu/opt directory permission denied issue

ir flag

Ubuntu Newbie here!

I am currently trying to install OpenFoam 10 in my machine, and need to edit the bashrc file located in Ubuntu/opt/openfoam/etc. Anytime I try to manually open the file and edit it I get this error:

Failed to save document#

Error opening file "opt.openfoam10/etc/bashrc": permission denied

I also tried to use the sudo gedit command to access the file and get this other error from the terminal:

sudo gedit ~./bashrc mkdir: cannot create directory '/run/user/0': Permission denied Authorization required, but no authorization protocol specified

However, when I look at the permission in the folder, /opt directory has drwxr-wr-x, so it seems like my user does not have 'root' permissions? I feel I might be missing some simple setting but can't seem to find what it is.

Any help is much appreciated.

hr flag
I'd suggest using a CLI editor with sudo - you could use `sudoedit /opt/openfoam/etc/bashrc` or specify a particular editor like `sudo nano /opt/openfoam/etc/bashrc`
petep avatar
in flag
Try "sudo -E gedit file"
MigWeld-o avatar
ir flag
@steeldriver your method worked perfectly, thanks so much!
I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.