How do I create a new file in a folder owned by root? Specifically, I want to add a file to /etc/X11/xorg.conf.d

17,116

First, create the file, using the editor of your choice. Store it in a user directory, something in or under $HOME Check it to be sure it says what you think it says, and does what you want. Then, and only then:

sudo cp yourfile /etc/X11/xorg.conf.d/50-mouse-acceleration.conf
Share:
17,116

Related videos on Youtube

Laa-Laa
Author by

Laa-Laa

Updated on September 18, 2022

Comments

  • Laa-Laa
    Laa-Laa over 1 year

    I want to add a new file to /etc/X11/xorg.conf.d as seen at the bottom of this page, but I can't as it's owned by root user. How to?

    EDIT: I managed it using the information on this page:

    • goo
      goo almost 9 years
      Are you looking for a "command line" answer, or are you a Point-Click-and-Wonder-What-Happened type of questioner>?
    • Laa-Laa
      Laa-Laa almost 9 years
      I'd like a command line answer I guess. Sorry if it's a stupid question, just got Ubuntu yesterday coming from windows
  • Laa-Laa
    Laa-Laa almost 9 years
    This is what I tried first! But when I try to save it it says "Could not find the file “/etc/X11/xorg.conf.d/50-mouse-acceleration.conf”. Please check that you typed the location correctly and try again."
  • Stephen
    Stephen almost 9 years
    Sorry, updated, I forgot, ubuntu uses a different location
  • Laa-Laa
    Laa-Laa almost 9 years
    Thanks, I should have realized to try that again when I learnt that Ubuntu used a different path :) ... and even more should have used the correct path in my post -_-
  • Stephen
    Stephen almost 9 years
    Why the edit, A.B.?
  • A.B.
    A.B. almost 9 years
    @Stephen sorry for the edit without a comment. But you shouldn't use sudo to start a GUI, it's OK, to start an application with a CLI. Use sudo -i, pkexec or gksudo for applications with a GUI like Gedit and so on.
  • A.B.
    A.B. almost 9 years
    If you write me a message, use @A.B.. I don't get a ping without the @
  • Stephen
    Stephen almost 9 years
    @A.B. So the potential side effect of not doing "-i" and inheriting root's environment is that you get temp files created in your home that could prevent the correct operation of programs running as your user? Are there other side effects?
  • A.B.
    A.B. almost 9 years
    Anywhere on Ask Ubuntu is a very long discussion for this.