Hi all. During CKA exam, when a question is completed, why do we need to run "ex . . .

Sparsh Gupta:
Hi all. During CKA exam, when a question is completed, why do we need to run “exit” command? We can just directly switch to another context as per question right?

Ryebridge:
You only exit if you have to log on to a terminal, otherwise use context. Keep an eye on where you are, you don’t get marked for answers on the wrong cluster. Also be very careful to use “sudo” when u need it. I didn’t use sudo -I as you can exit from root thinking you’re back to base, great tip from @Vitor Jr. there !!

Jafar:
so, if we SSH into any node and assume elevated privileges, we have to exit twice…right?

Pramod Raghavendra:
be careful when u exit… i exited and it kicked me out of the exam window… so be watchful…

Ryebridge:
Well, if you use sudo <cmd>, you should only have to exit once. sudo -i on the other hand, twice so be careful man !

Hanzala Siddique:
@Pramod Raghavendra So how did you come back?

Hanzala Siddique:
@Sparsh Gupta If u have ssh into a node then you have to exit , or else just switch to another context … I think

Sparsh Gupta:
@Hanzala Siddique - Bingo !! I don’t know why people keep on mentioning to exit if you are not ssh’ed inside any node. Exiting out will kick out the window.

Sparsh Gupta:
Thanks

Adeola Adefolaju:
@Ryebridge, so when do I use sudo -i? When inside another node?

Jafar:
sudo -i will switch you to root…and you have to type “exit” to go back to normal user…

Instead you should use “sudo <your command>” to run as root…so no need to remember to type “exit” to go back to normal user

Adeola Adefolaju:
Thanks @Jafar, so you mean I do not need to use sudo -i. I only need to use sudo <cmd> to be able to execute a command inside a node? Is it every command or what kind of commands? Sorry to ask this questions, I am new to Linux and only know a few basic commands for CKA.

Jafar:
“sudo <your command>” only if that command needs to be run as root…
otherwise you can run commands without sudo also

Adeola Adefolaju:
Ok you were replying while I was editing my earlier message lol

Adeola Adefolaju:
thanks a lot @Jafar

Jafar:
This will make it more clear
image.png

Adeola Adefolaju:
Thanks so much @Jafar. Really appreciate it.

Pramod Raghavendra:
@Hanzala Siddique to answer ur question on how i came back… i had to ping the proctor and ask him to let me in one more time… at tat time he warned me…dont do exit again and you wont be able to get in one more time…

Pramod Raghavendra:
As @Ryebridge suggested… best is to use sudo <command> so that u dont change the user to root… when u do sudo -i, it puts u in the terminal as root user and you have to exit to come out of that root user and come back to student user…

Hanzala Siddique:
ok @Pramod Raghavendra Luckily u got a chance