2

In my sudo command, if I don't mention username, will it take root as the default user? For example, In the following command-

sudo mkdir /tmp/computerLinux/

using which target user will it execute the command?

5
  • 3
    sudo means "root user". So, it will obviously take the credentials of the "root" account.
    – palerdot
    Aug 20, 2013 at 6:06
  • 3
    @palerdot: Yet the headline of the man page reads: "sudo - execute a command as another user" :-)
    – NPE
    Aug 20, 2013 at 6:11
  • but what if a root user does not exist, has no passwd set and no ~ dir?
    – woodz
    Oct 28, 2020 at 13:53
  • is there a way to print out and configure the default user?
    – woodz
    Oct 28, 2020 at 13:53
  • root does not need a psswd since sudo grants all permissions to the requesting sudoer. The ~ dir of root is /root not /home/root Thus you are able to edit / delete files inside /root with sudo
    – woodz
    Oct 28, 2020 at 14:07

1 Answer 1

4

Yes, from manual of sudo:

-u The -u (user) option causes sudo to run the specified command as a user other than root. To specify a uid instead of a username, use #uid.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .