Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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
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

3 Answers 3

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

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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