2

I am having Permission denied errors after logging with non root user (which has permissions to do "sudo -i" command). I get these errors:

-bash: /bin/uname: Permission denied
-bash: [: =: unary operator expected
-bash: /bin/sed: Permission denied
-bash: /bin/ls: Permission denied
-bash: /bin/ps: Permission denied
-bash: /bin/ps: Permission denied
-bash: /bin/uname: Permission denied
-bash: /bin/ps: Permission denied
-bash: /bin/uname: Permission denied
-bash: [: =: unary operator expected
-bash: /bin/sed: Permission denied
-bash: /bin/ls: Permission denied

I don't have root user, but user "superuser" with which i log-in has permission to do "sudo -i" command. So, after every SSH log-in i am writing "sudo -i" command to get root access just to get "ls -la" command working. I am using Ubuntu 12.04 (Precise).

This is probably related to shell permissions and similar stuff, so pointing to right direction would be awesome.

  • What exactly are you doing which causes these errors? – fkraiem Jul 11 '14 at 9:46
  • @fkraiem, As I said, these errors occur right after logging in through SSH connection. Every command displays permissions denied error, but after executing "sudo -i" command, everything works well. – Paulius Pazdrazdys Jul 11 '14 at 9:50
0

edit: I misunderstood your question (before your edits). Your target system seems to be set up without execute rights for all on the /bin/* content. That is either intentional, or a configuration error.

ls -al /bin

(as root) should show you if that is the case. For example, on my system, I get:

ls -al /bin/ls

-rwxr-xr-x 1 root root 110080 Mar 24 15:35 /bin/ls

I assume for your system it is -rwxr-xr-- 1 root root 110080 Mar 24 15:35 /bin/ls

So, to solve your problem, fix the rights on /bin.

|improve this answer|||||
  • I think that ssh shell is really chroot'ed, because every command just gives me permission denied error (which probably is not related to faulty file, but more initial permissions stuff), if i'm not executing "sudo -i". How can I check chroot settings, and maby adjust them? – Paulius Pazdrazdys Jul 11 '14 at 9:55
  • Paulius: I updated my answer to reflect your changes in the question. Please let me know if the general /bin setup is messed up on your target machine – noleti Jul 11 '14 at 10:15
  • My /bin/ls permissions where 750, and I see that your's are 755. Changing permissions to 755 fixes that particular error related with /bin/ls, but is it safe to have these kind of permissions on /bin/*? After changing permissions to problematic /bin files I now receive these permission denied errors: -bash: /usr/bin/awk: Permission denied -bash: /usr/bin/dpkg: Permission denied -bash: /usr/bin/tr: Permission denied -bash: /bin/cat: Permission denied. So it is now related to /bin/* and /usr/bin/* permissions. – Paulius Pazdrazdys Jul 11 '14 at 10:28
  • None of my *nix boxes has 750 permissions on /bin and /usr/bin. They all have 755 by default. I'm not sure how your machine ended up being configured that way, but I'm sure that having 755 on /bin and /usr/bin is the default and safe way. – noleti Jul 11 '14 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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