How do I stop using root privileges?
Solution 1
User privileges are associated with processes. In this case, your superuser privileges are associated with the shell that ran when you did sudo su
. You need to exit that shell. To do that use the aptly-named exit
command.
If you haven't messed with the prompt definitions, superuser status is indicated by a #
in the prompt instead of the user's $
.
Solution 2
When you su
, a new login shell is started for the root user; to drop root privilege and go back to your usual login, simply logout
or hit Control-D.
Related videos on Youtube
Quazmai
Updated on September 18, 2022Comments
-
Quazmai over 1 year
I'm given the following method written in pseudo-code
for i=1 to floor(n/2) if arr[i] != 0 then for(j=2 to floor(n/i) arr[i*j] = 0
I need to find the output and to prove that it's indeed the output.
So far I tried to write the code in Java and to try different inputs and array sizes but to no avail. Putting it here if it's of any help:
public class Checking { private static int method(int[] A,int n) { for (int i=1;i<=java.lang.Math.floor(n/2);i++) { if(A[i] != 0) { for(int j=2;j<=java.lang.Math.floor(n/i);j++) { A[i*j]=0; System.out.println("The index ofA["+i*j+"] became "+A[i*j]); } } //System.out.print(", "+A[i]); } for (int i=1;i<=java.lang.Math.floor(n/2);i++) { System.out.print(", "+A[i]); } return 0; } public static void main(String[] args) { int[] A = {-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}; System.out.println(method(A,20)); } }
Thank you.
-
Isaac Rabinovitch about 11 yearsYou mean like this? blog.utest.com/how-pixar-almost-deleted-toy-story-2/2012/05
-
TheWildHealer over 4 yearsWhat's your question? Does your code give an error? In that case, include the error message. Does it give a wrong output? In that case, include expected and actual outputs and how they differ.
-
-
Brian Peterson about 11 yearsThanks a lot. Immediately after writing my question, I tried "su my_name", because I realized it stands for substitute user. I also thought it worked, until I tried "exit" as you suggested, haha.
-
Alex.K. over 9 yearsAlso you can use hot key combination 'Ctrl+D' to to exit superuser shell.
-
Quazmai over 4 yearsHi, thank you for the answer, but missing the first index is intentional, as the pseudo-code dictates (was weird for me too). The rest is fixed but still my question remains unsolved :(
-
Ioannis Barakos over 4 yearsThe pseudo-code explains how to update the array. The second loop (starting from index 0) shows how to print the array. So you use the pseudo code to update A but you need some code to print All the array date. I updated the answer with a simplest print solution for arrays