[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Authentication failed after su-



On 2/28/22 13:09, Dan Ritter wrote:
sudo su - -l -c "rest of the line"

Some comments on this, without knowing just how it failed:

1.  There is no reason I can see to using both 'sudo' and 'su' together.  By default, they both let you run a command as the root user.

2.  Using both '-' and '-l' with su is redundant, they do almost (per the man page) the same thing.  The man page suggests '-l' is better due to reduced side effects.

3.  The -c option provides a means to tell su to run a specific command.  So the string 'rest of the line' generates an error stating 'command not found' if run as is.  You need to supply this part of the line so processing can be duplicated and evaluated.

If I insert an 'echo' before the word 'rest', there is no error.

Hence, the actual error is needed, as well as the actual command being run.

Bob


Reply to: