8.6. Running Commands as the lockss User

Unless otherwise noted, most commands in this manual are intended to be run as the lockss user (oftentimes in the lockss user's lockss-installer directory). This section describes two methods for doing so.

8.6.1. Running Commands as lockss With sudo

If you are logged in as a user who can run commands as lockss via sudo:

  • You can start a Bash shell session as the lockss user and run any number of commands in it:

    1. Run this command 1:

      sudo -i -u lockss
      

      Tip

      You can also use the slightly shorter version sudo -iu lockss.

    2. Run commands as they are listed in the manual, for example scripts/start-lockss --wait.

    3. When you are done, exit the lockss shell session by typing exit or logout or hitting Ctrl + D.

  • Alternatively, you can use sudo to run a single command as the lockss user.

    Add the following in front of the command listed in the manual 1:

    sudo -u lockss ...
    

    For example, if the command listed in the manual is scripts/start-lockss --wait, you would type sudo -u lockss scripts/start-lockss --wait.

8.6.2. Running Commands as lockss With su

If you are logged in as root but your system does not have sudo (or does not let root use sudo), you can use su instead:

  • You can use su to start a Bash shell session as the lockss user and run any number of commands in it:

    1. Type this command:

      su lockss
      
    2. Run commands as they are listed in the manual, for example scripts/start-lockss --wait.

    3. When you are done, exit the lockss shell session by typing exit or logout or hitting Ctrl + D.

  • Alternatively, you can use su to run a single command as the lockss user:

    Put the command listed in the manual in quotation marks in the following way:

    su -c '...' lockss
    

    For example, if the command to be run as the lockss user is scripts/start-lockss --wait, you would type su -c 'scripts/start-lockss --wait' lockss.

    Caution

    You will need to take care if the command itself contains quotation marks 2 .


See Also


Footnotes

1

Depending on your system's sudo configuration, you may be prompted for the user's sudo password.

2

If the command contains quotation marks, use -c "..." instead of -c '...', and add a backslash in front of each double quotation mark in the command (\" instead of "); single quotation marks in the command are unchanged.