I want to setup a VPS that is is open to a few people for them to execute a program. They will connect via SSH. Is there a way for me to keep them from running root commands (sudo, su)?

I tried installing Openssh-server on my laptop running ubuntu 14.04.3 and tried connection via my phone using my password and even though I had PermitRootLogin set to no, I was able to run sudo commands.

  • Why not just disable sudo for the altogether?
    – muru
    Feb 20, 2016 at 9:41
  • I still want access to sudo for myslef. Feb 20, 2016 at 9:46
  • Keep it for you, disable for them.
    – muru
    Feb 20, 2016 at 9:47
  • I am looking for a guide to do that, any recommendations besides HATEthePLOT's (which is great)? Feb 20, 2016 at 9:49
  • That depends on how you granted them sudo access in the first place? Via a group? Via individual entries to /etc/sudoers?
    – muru
    Feb 20, 2016 at 9:51

1 Answer 1


Maybe you want to check out this link. The point is that PermitRootLogin diasbles login via the user root. This is a security risk. However, your normal user can always login an then escalate to root (e.g. via sudo). An attacker would need two sets of passwords: your user's and root's password, which makes it harder (given you have sane password policies).

If you want to disable a user from sudo you have to take this priviledge from him. However, this woud request you doing it on your laptop you want to connect to. AND FURTHER, this will disable your user to use sudo on your laptop -- so careful: you might lock yourself out of the system when your only user is removed. (This link might be helpful)

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.