Shared server guidance · Question & answer

How do I check what sudo commands I am allowed to run?

sudo applies the server’s privilege policy to a specific command. Use sudo -l to inspect your permitted actions before assuming administrator access. A prompt usually requests your own authentication, subject to the server’s configuration; credentials should never be embedded in command examples or shared in support messages.

BeginnerLinux VPS and dedicated servers with GNU utilities
Go to the answer

Before you start

  • The server uses sudo and the account may inspect its own privilege policy.

Instructions

1. Read the effective policy

Run this in your own authenticated session. The policy may limit target users, command paths, arguments or authentication requirements.

Remote Linux shell
sudo -l

Read the permitted commands and restrictions. Do not paste the complete policy publicly if it reveals sensitive service paths.

2. Check identity only when permitted

If the policy permits it, a narrowly scoped identity command confirms which user sudo selects. Prefer elevating the particular administrative command over keeping a broad root shell open.

Remote Linux shell
sudo -u root id -un

Successful output of root confirms this command’s execution identity; it does not prove other commands are allowed or that an application is healthy.

Check the result

  • The required action is explicitly permitted, and the target execution identity is appropriate for that action.

Troubleshooting

The account is not in sudoers
Ask an existing authorised administrator to grant the required role through the approved policy; there is no legitimate bypass in this workflow.
A sudo command is rejected despite a similar listed command
Restrictions may include the exact binary, target user or arguments. Compare the policy precisely.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.