LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to fix "sudo: unable to execute /bin/ls: Permission denied"? (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-fix-sudo-unable-to-execute-bin-ls-permission-denied-4175426455/)

nagendrar 09-10-2012 01:08 AM

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

ravi_nandula 09-10-2012 01:19 AM

Quote:

Originally Posted by nagendrar (Post 4776581)
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

chrism01 09-10-2012 08:30 PM

Why would you need sudo for ls? That's one of the basic cmds available to anyone.

nagendrar 09-11-2012 12:30 AM

ravi, Thank for your reply. But we already have these settings in sudoers file.

please help me to solve the problem.

ThanQ,
Nagendra

ravi_nandula 09-11-2012 12:32 AM

Quote:

Originally Posted by nagendrar (Post 4777399)
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.....

nagendrar 09-11-2012 03:05 AM

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

abhinav4 09-11-2012 04:56 AM

Quote:

Originally Posted by nagendrar (Post 4777487)
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

chrism01 09-11-2012 05:33 AM

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

TobiSGD 09-11-2012 05:33 AM

This is something that should rather be solved using file-permissions and user groups than with using sudo, I would think.

aniketmeshram 09-13-2012 02:56 PM

just make the

Code:

<username> ALL=(root)NOPASSWD:/bin/ls
to
Code:

<username> ALL=(root)NOPASSWD:ALL
report if any problems.

PTrenholme 09-13-2012 04:19 PM

Quote:

Originally Posted by aniketmeshram (Post 4779677)
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"? :scratch: That might cause problems in a multi-user system.

TobiSGD 09-14-2012 03:22 AM

Quote:

Originally Posted by aniketmeshram (Post 4779677)
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.

aniketmeshram 09-14-2012 06:55 AM

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


All times are GMT -5. The time now is 08:54 AM.