Linux Fundamentals

i can’t find out answer for “Which option needs to be set to execute a command as a different user using the “su” command? (long version of the option)”
even i have tried -l, --login and many more but don’t reach there.

I am not sure what the answer to this is, as I haven’t really looked at the academy stuff.

However, to switch to a different user, you’d normally use:
su username

The -l / --login is focused on how the shell is built.

If you want to run a command as a different user, then it is slightly different. You aren’t switching, you just want a command to run. Re-read the man page.

I just did this. What I did was run the “man su” to search for command.

Its asking for -c or --command

Type your comment> @Laughingg said:

I just did this. What I did was run the “man su” to search for command.

Its asking for -c or --command
May be its --command

@HAKSEC403 said:

Type your comment> @Laughingg said:

I just did this. What I did was run the “man su” to search for command.

Its asking for -c or --command
May be its --command

Either should work.

Did you find the answer? I am stuck on the same question and I read man su, dozen times and nothing is accepted as the answer

I have found the correct answer is:

--command

Here’s a brief explanation, the question is…

What option to put to run a command as a different user using the “su” command? (long version of the option)

It looks like su is already being executed, so the only thing we would be missing is the command, and we need to use the long option.