-1

I've just started learning Linux at uni, and my first homework is to:

change current user to admin, do some stuff with environment variables, switch back to normal user

I can normally log in under my account which is superuser, but the idea is to switch to SU, set an env-variable, and see that normal users can't access it (if my theory is correct). On the other hand I can log in as a guest, but neither sudo nor su commands work

sudo: Operation not permitted
su: Authentication failure

How do I create/become this "normal user" and complete the task?

4
  • add a user that doesn't have admin privileges and do it from that account. you will need to add the new user to sudoer group for sudo to work, but su should work.
    – ravery
    Sep 17, 2017 at 20:15
  • Homework is off topic, sorry. Sep 17, 2017 at 20:17
  • Oh, yeah, I humbly ask you to forgive me for being a smart being and specifying a little more details than "how to switch to superuser/work with root", when those questions are not the same as mine (sort of), and those old topics don't include the working solution.
    – Alex F
    Sep 17, 2017 at 21:32
  • 1
    Reviewing the meta questions about homework I don't think it's justified to say that homework is off-topic. It's evident from the question that Alex F has already had a go at doing it, and is now extending their research to ask a question about it here, which seems pretty reasonable to me.
    – Zanna
    Sep 18, 2017 at 19:45

1 Answer 1

1

In the shell you should do:

sudo su

and enter your password. After that you can create a variable, for example like this:

export MY_ENV="some value"

You can check, if it was set successfully:

echo $MY_ENV

Please pay attention to the dollar sign. When you define an environment variable you don't use the dollar sign, only when you call it after that.

Now you can:

exit

Now you have switched to normal user mode. Try again:

echo $MY_ENV

and see what happens.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .