LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 09-10-2012, 01:08 AM   #1
nagendrar
Member
 
Registered: Apr 2008
Location: HYD, INDIA.
Posts: 131

Rep: Reputation: 15
how to fix "sudo: unable to execute /bin/ls: Permission denied"?


When I run the "/bin/ls" command with sudo. I am getting following error "sudo: unable to execute /bin/ls: Permission denied".

But we have the following line in /etc/sudoers file
<username> ALL=(root)NOPASSWD:/bin/ls


Please help me to solve the problem.

ThanQ,
Nagendra

Last edited by nagendrar; 09-10-2012 at 01:10 AM.
 
Old 09-10-2012, 01:19 AM   #2
ravi_nandula
Member
 
Registered: Sep 2011
Posts: 80

Rep: Reputation: Disabled
Quote:
Originally Posted by nagendrar View Post
When I run the "/bin/ls" command with sudo. I am getting following error "sudo: unable to execute /bin/ls: Permission denied".

But we have the following line in /etc/sudoers file
<username> ALL=(root)NOPASSWD:/bin/ls


Please help me to solve the problem.

ThanQ,
Nagendra
Please check this url.....which is related to give sudo to particular command to a user .

http://www.linuxquestions.org/questi...access-584219/

Thanks
 
Old 09-10-2012, 08:30 PM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5
Posts: 16,086

Rep: Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995
Why would you need sudo for ls? That's one of the basic cmds available to anyone.
 
Old 09-11-2012, 12:30 AM   #4
nagendrar
Member
 
Registered: Apr 2008
Location: HYD, INDIA.
Posts: 131

Original Poster
Rep: Reputation: 15
ravi, Thank for your reply. But we already have these settings in sudoers file.

please help me to solve the problem.

ThanQ,
Nagendra
 
Old 09-11-2012, 12:32 AM   #5
ravi_nandula
Member
 
Registered: Sep 2011
Posts: 80

Rep: Reputation: Disabled
Quote:
Originally Posted by nagendrar View Post
ravi, Thank for your reply. But we already have these settings in sudoers file.

please help me to solve the problem.

ThanQ,
Nagendra
Why do you need to add "ls" command in the sudoers file.?????????????
For any user ls will work.....
 
Old 09-11-2012, 03:05 AM   #6
nagendrar
Member
 
Registered: Apr 2008
Location: HYD, INDIA.
Posts: 131

Original Poster
Rep: Reputation: 15
If we want to display files in another user from one user then 'ls' won't work.

All Files in /proc/ won't display using ls.

Regards,
Nagendra
 
Old 09-11-2012, 04:56 AM   #7
abhinav4
Member
 
Registered: Jun 2010
Location: India
Distribution: Fedora/Cent OS
Posts: 123

Rep: Reputation: 0
Quote:
Originally Posted by nagendrar View Post
If we want to display files in another user from one user then 'ls' won't work.

All Files in /proc/ won't display using ls.

Regards,
Nagendra
If you are not able to view a file using ls, it means you do not have permission for that file. ls is a very basic command open for all user unless you are manually changing the file permission of /bin/ls
 
Old 09-11-2012, 05:33 AM   #8
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5
Posts: 16,086

Rep: Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995Reputation: 1995
It definitely sounds like your system is stuffed up.
You should be able to ls /proc, no worries.
Also, as above, most other user's files, unless they have disabled other/world perms and group perms.

Which distro do you have
Code:
cat /etc/*release*
possibly as root in your case ...

What have you been doing to this system??
 
Old 09-11-2012, 05:33 AM   #9
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Slackware
Posts: 14,872
Blog Entries: 2

Rep: Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805
This is something that should rather be solved using file-permissions and user groups than with using sudo, I would think.
 
Old 09-13-2012, 02:56 PM   #10
aniketmeshram
LQ Newbie
 
Registered: Feb 2011
Distribution: OpenSUSE 10.3, Fedora, Ubuntu
Posts: 21

Rep: Reputation: 0
just make the

Code:
<username> ALL=(root)NOPASSWD:/bin/ls
to
Code:
<username> ALL=(root)NOPASSWD:ALL
report if any problems.
 
Old 09-13-2012, 04:19 PM   #11
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,141

Rep: Reputation: 329Reputation: 329Reputation: 329Reputation: 329
Quote:
Originally Posted by aniketmeshram View Post
just make the

Code:
<username> ALL=(root)NOPASSWD:/bin/ls
to
Code:
<username> ALL=(root)NOPASSWD:ALL
report if any problems.
Wouldn't that give <user> permission to run any command as "root"? That might cause problems in a multi-user system.
 
Old 09-14-2012, 03:22 AM   #12
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Slackware
Posts: 14,872
Blog Entries: 2

Rep: Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805
Quote:
Originally Posted by aniketmeshram View Post
just make the

Code:
<username> ALL=(root)NOPASSWD:/bin/ls
to
Code:
<username> ALL=(root)NOPASSWD:ALL
report if any problems.
This would give the user the rights to run any program as root without password. This is the worst setting you can have with regards to security and can be considered to be bad advice.
 
Old 09-14-2012, 06:55 AM   #13
aniketmeshram
LQ Newbie
 
Registered: Feb 2011
Distribution: OpenSUSE 10.3, Fedora, Ubuntu
Posts: 21

Rep: Reputation: 0
PTrenholme, TobiSGD, guys!! I gave him the suggestion to check if the problem exist over all.
Thats why i said "report if any problem" if it doesn't i would have suggested to change the sudoers setting so that only he gets the access control.
I didn't say that's the final answer. Usually, once adding the local user name to sudoers list doesn't give problems.
I don't know why he was having one. That's why!!.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Getting permission denied when running "sudo bash" Clariollo Red Hat 6 01-25-2012 02:18 PM
Tried to install a .bin but "bash: ./CmapTools64.bin: Permission denied" Xime1008 Linux - Newbie 6 05-16-2011 06:24 PM
Failed to execute child process "ooffice" (Permission denied) Mol_Bolom Linux - Software 2 03-11-2009 04:23 PM
can't execute c++ binaries, "permission denied"... even though permission is 777 SerfurJ Programming 14 02-20-2009 04:50 AM
"sudo mount -a" works perfect but permission denied when mounting on startup, why? aaron4katie Linux - Software 10 01-11-2007 10:16 AM


All times are GMT -5. The time now is 01:53 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration