I have a file mathpass (without a file ending .*) in /home/patrick/Documents and want to copy it via drag and drop to /usr/local.

If I do so, a message Access denied. Could not write to. appears. What is the problem? I already tried sudo su in both directories.

closed as unclear what you're asking by Michael Homer, Jeff Schaller, Toby Speight, Kiwy, G-Man Feb 16 '18 at 6:14

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    What do you mean by 'I already tried sudo su in both directories.'? – Matt Feb 15 '18 at 7:57
  • Depending on the files, often it is better to put such files in own home. Checkout e.g. ~/bin/ , ~/lib/, ~/include. – Giacomo Catenazzi Feb 15 '18 at 8:49

If you are trying to drag and drop it means you are doing it from a GUI file explorer. Those, as most other programs run unprivileged by default, meaning that the program has no permissions to write on /usr/local .

The best approach is to simply open a terminal and write:

sudo cp /home/patrick/Documents/mathpass /usr/local