LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 06-10-2015, 12:11 PM   #1
Davdi
Member
 
Registered: May 2013
Location: Wellingborough
Distribution: Mint 19, Open Suse tumbleweed, Xubuntu
Posts: 30

Rep: Reputation: Disabled
Permission denied when adding repo from terminal on Raspberry Pi


I'm trying to add a repo using the following line in a terminal on a Raspberry Pi running raspbian:

sudo echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list

and I get the following message:

bash: /etc/apt/sources.list: Permission Denied

I've tried using Synaptic (settings --> repositories) but It doesn't give me the repositories dialog box, it just says the repositories have changed.
(I do get the repositories dialog box when I try in Mint(debian edition).

This is part of setting up Glastopf honeypot on the Pi in preparation for a Security Summer School for 2nd/3rd year students.

All help and suggestions welcome.
 
Old 06-10-2015, 01:05 PM   #2
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
What happens when you try to open the file itself?
Code:
vim /etc/apt/sources.list
or
less /etc/apt/sources.list
Since this is very likely a permissions error, check the directories under it and the file itself. Also make sure you are in the sudoer group and the command echo is a accepted sudo command. I think you can check that with visudo
If nothing works, switching to root and doing the same thing should work.
 
Old 06-10-2015, 01:21 PM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
This is not a permissions error. The sudo command simply is run after the shell has tried to open the sources.list file for appending, so that this is still tried as normal user, not as root.
Run
Code:
sudo -i
to get a root shell and try the command again, without the sudo in front of it.
 
Old 06-11-2015, 07:04 AM   #4
Davdi
Member
 
Registered: May 2013
Location: Wellingborough
Distribution: Mint 19, Open Suse tumbleweed, Xubuntu
Posts: 30

Original Poster
Rep: Reputation: Disabled
Solved

Many thanks TobiSGD. sudo -i for a root shell and it worked.

Isn't it a security hole though? I can sudo -i and get a root terminal without entering root's password.

I must try scripting that.
 
Old 06-11-2015, 07:32 AM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by Davdi View Post
Many thanks TobiSGD. sudo -i for a root shell and it worked.

Isn't it a security hole though? I can sudo -i and get a root terminal without entering root's password.

I must try scripting that.
Everytime you use sudo you are becoming root without knowing the root password. You could also try to run
Code:
sudo bash
which would have a similar effect. This is due to the way Ubuntu uses sudo. It can be configured in a way that the user can only use specific commands with sudo.
 
  


Reply

Tags
backport, debian repositories, security



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mkdir throws Permission Denied error in a directoy even with root ownership and 777 permission surajchalukya Linux - Security 14 09-03-2012 08:34 AM
permission denied in terminal window Patrick-Warwick Linux - Newbie 3 05-26-2008 04:11 AM
adding repo ammaro Debian 4 03-26-2008 07:15 AM
'permission denied" inspite of right permission flags on network drive anirudhvij Linux - Enterprise 8 05-22-2007 05:57 AM
adding mirror to yum.repo.d/<any-repo> ashwin_cse Fedora 1 03-10-2005 03:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration