Welcome to the Linux Foundation Forum!

Root privileges during exam

Options

The LFCS preparation guide pg.18 says that root privileges in the exam terminal can be obtained by entering 'sudo -i'. So anytime we run the sudo command we have to include the '-i' flag?

Comments

  • coop
    coop Posts: 915
    Options

    I do not know and it may depend on the platform used. These kinds of questions should be directed to the certification help staff, for which you should have a link, if you want to get an authoritative answer as any thing else may not be 100 percent right.

    You should try the following two commands:

    sudo ls -l
    sudo -i ls -l
    

    and see the difference. AFAIK, it is whether root's shell init files are read in and the current directory reset etc, kind of like su vs su - .

  • luisviveropena
    Options

    Hi justinnoor,

    As coop said, you should ask the certification help staff. But running 'sudo -i ' won't hurt a bit, as it's a way to ensure that you are running commands under a certain command environment (root's in this case). You can confirm this by seeing the sudo man page where it's explained.

    Regards,
    Luis.

  • chris66
    chris66 Posts: 4
    Options

    Justin have you not practiced that on your distro ? the --help shows that the -i option is for login, so it is giving you a login afterward, on Centos7 it prompts me for my password so I can perform that next command as root and it appears you become the root user, I had previously used ' su - ' to do that.

  • coop
    coop Posts: 915
    Options

    the difference is sudo requires only your user password (and has more auditing) and su requires the root password. Big difference. Also sudo must be configured for each user to configure usage in /etc/sudoers or /etc/sudoers.d (by root)

Categories

Upcoming Training