Skip to main content
added 3 characters in body
Source Link
Andy Dalton
  • 14.7k
  • 1
  • 28
  • 50

If which date produces different results for root and another user, then it's likely that they have different values for PATH. The normal user has /bin earlier than /usr/bin (or without /usr/bin at all) and root has /usr/bin/ before /bin (or withwithout /bin at all).

You can verify this by running:

echo ${PATH}

as both root and the non-root user.

The PATH variable is a colon-delimited list of directories in which the shell looks for commands when the absolute path isn't provided. The shell will search those directories, left to right, in the order that they're listed. If the shell finds a command in a directory, then it executes it. The which command does a similar walk and reports the first match that it finds.

If which date produces different results for root and another user, then it's likely that they have different values for PATH. The normal user has /bin earlier than /usr/bin (or without /usr/bin at all) and root has /usr/bin/ before /bin (or with /bin at all).

You can verify this by running:

echo ${PATH}

as both root and the non-root user.

The PATH variable is a colon-delimited list of directories in which the shell looks for commands when the absolute path isn't provided. The shell will search those directories, left to right, in the order that they're listed. If the shell finds a command in a directory, then it executes it. The which command does a similar walk and reports the first match that it finds.

If which date produces different results for root and another user, then it's likely that they have different values for PATH. The normal user has /bin earlier than /usr/bin (or without /usr/bin at all) and root has /usr/bin/ before /bin (or without /bin at all).

You can verify this by running:

echo ${PATH}

as both root and the non-root user.

The PATH variable is a colon-delimited list of directories in which the shell looks for commands when the absolute path isn't provided. The shell will search those directories, left to right, in the order that they're listed. If the shell finds a command in a directory, then it executes it. The which command does a similar walk and reports the first match that it finds.

Source Link
Andy Dalton
  • 14.7k
  • 1
  • 28
  • 50

If which date produces different results for root and another user, then it's likely that they have different values for PATH. The normal user has /bin earlier than /usr/bin (or without /usr/bin at all) and root has /usr/bin/ before /bin (or with /bin at all).

You can verify this by running:

echo ${PATH}

as both root and the non-root user.

The PATH variable is a colon-delimited list of directories in which the shell looks for commands when the absolute path isn't provided. The shell will search those directories, left to right, in the order that they're listed. If the shell finds a command in a directory, then it executes it. The which command does a similar walk and reports the first match that it finds.