Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to do change a filename and copy a file to the folder /etc/apt, but the folder is locked. How do I unlock it?

share|improve this question

closed as unclear what you're asking by David Foerster, Eric Carvalho, Pilot6, A.B., muru Aug 21 '15 at 11:56

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.

What do you mean it's "locked"? Please include in your question: 1) What you are exactly doing (be specific), 2) What the error message is exactly, 3) What you are trying to achieve in the first place. Please provide this information by editing your question. Oh and be careful changing files there! You can end up in a system without updates for example. – gertvdijk Jul 3 '13 at 22:12
up vote 0 down vote accepted

Use the sudo command to gain root access. For example:

sudo -H /bin/bash
cd /etc/apt
do your editing of files

Good practice is to save a copy of the original files (e.g. Adding a .orig suffix), before editing.

share|improve this answer
Thanks, this did it! – Rainer Oetzel Jul 4 '13 at 1:38
May I suggest sudo -i in place of sudo -H /bin/bash? – Andrea Corbellini Aug 18 '15 at 14:35

One way of doing this is by opening nautilus as root from the terminal:

sudo nautilus

From there, proceed as you have tried before, change the filename and copy your file

share|improve this answer

To change a file name:

sudo mv /etc/apt/somefile /etc/apt/somefile.bak

To move a file into that directory:

sudo cp ~/somefile2 /etc/apt

The ~ supposes that the existing file is in your /home/user directory. If it is somewhere else, for instance Desktop, then:

 sudo cp ~/Desktop/somefile2 /etc/apt  

Please proceed with caution and ask for clarification if needed.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.