0

My account has been created on a LINUX machine. But, I don't know which type of user I am ( root user or normal user) and which type of access I have. Is there any command through which I can check whether I have sudo access or not in a linux machine if I already have an account.

4

Use sudo -l to determine what level of capabilities you have assigned within its configuration.

From man 8 sudo

   -l[l] [command]
        If no command is specified, the -l (list) option will list the 
        allowed (and forbidden) commands for the invoking user (or the user 
        specified by the -U option) on the current host.  

        If a command is specified and is permitted by the security policy, 
        the fully-qualified path to the command is displayed along with any 
        command line arguments.  If command is specified but not allowed, 
        sudo will exit with a status value of 1.  

        If the -l option is specified with an l argument (i.e. -ll), or if 
        -l is specified multiple times, a longer list format is used.
  • After executing sudo -l command, I have to input password and then it display message - sorry, user may not run sudo on servername. – ursitesion Apr 11 '14 at 11:04
  • That means you have no special privileges enabled by the sudo configuration. – cpugeniusmv Apr 11 '14 at 11:05
  • Does sudo access required for FTP connection? – ursitesion Apr 11 '14 at 11:06
  • Sounds like a separate question :) Making an outgoing FTP session from the server or incoming to the server? Plain FTP or SFTP? Setting up an FTP server? – cpugeniusmv Apr 11 '14 at 11:08
  • Yes, I raised a separate question too. unix.stackexchange.com/questions/124248/… – ursitesion Apr 11 '14 at 11:13
2

Try the command "id" to see which groups you are in. This will give you an idea about the account you are using.

id -a
0

You can type groups to see you groups

[user@system ~]$ groups
users

and you can just try to use sudo and see, wheater you have sudo access or not. You could try it with "ls". If you don't have sudo access you get an error:

[user@system ~]$ sudo ls
  • If I run above command (sudo ls) - it prompting for the my password. When I input my password, system prompt message like - users not in the sudoers file. This incident will be reported. – ursitesion Apr 11 '14 at 11:02
  • 1
    This means, you do not have sudo access. – Tobias Apr 11 '14 at 11:03
0

To see which groups you are part of try groups. Whether or not you have access to sudo depends on your local configuration.

If when running groups you don't see wheel or admins staff or a group specifically set up firsudo access then you likely haven't been automatically granted sudo-ing rights. Note that those can be added via the sudo configuration as well.

  • If I run groups command, I can see only my username in the output list. – ursitesion Apr 11 '14 at 11:03
  • You are part of a group that has the same name as your username. If you don't see wheel or admins staff or a group specifically set up to have sudo access then you likely haven't been automatically granted sudo-ing rights. Note that those can be added via the sudo configuration as well. – G. Cito Apr 11 '14 at 11:45

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.