This is a known issue, when you use sudo
in this fashion, it won't work right. That is because while the echo
command is run as sudo
, the >>
for append tries to open the file target as a non-sudo
user. That is where the permission issue is.
However, please read my multi-part answer, which gives you a separate solution that can be considered more 'safe' than the others I provide:
1:
Use a separate file in /etc/apt/sources.list.d/
which contains the deb instruction you're saying now. You'd still need to use sudo
, though, to edit / create the file.
2:
A solution would be to do sudo su -c "echo 'deb http://www.duinsoft.nl/pkg debs all' >> /etc/apt/sources.list"
, which tells the system to run that as superuser, which you get access to by using 'sudo' in front of the 'su' command.
PLEASE NOTE that the su
command used outside of the command I stated here is dangerous, so you should only use this method if you absolutely need it. Therefore, consider using Solution #3 here instead.
Safest Solution (#3): Use echo | sudo tee
AND a separate .list
You can achieve the same as the above, however, without ever dropping to a superuser prompt though. With this command:
echo 'deb http://www.duinsoft.nl/pkg debs all' | sudo tee -a /etc/apt/sources.list
However, let's also take into account #1 above, and instead use a new file for it:
sudo touch /etc/apt/sources.list.d/duinsoft.list
echo 'deb http://www.duinsoft.nl/pkg debs all' | sudo tee -a /etc/apt/sources.list.d/duinsoft.list
This way, we leave the main sources.list
alone, but the sources will be added via an included file that specifically handles this repository. (This is how PPAs get added, by the way!)
Best Answer
Here's a link which explains about Changing file permission (and ownership)
If you want to skip these (for now of course), you can create a directory/folder in your user-home directory and work on your
C
programmes (or others) there.You can open the terminal (press Ctrl + Alt + T) and
cd
to the target directory:To give the file "the_file_name" execute permission (if the file-system allows you with the RW rights):