How to change to normal user in the command line when logged in as the root user?

  • I log into an system as root via ssh.

    How do I become the normal user or another user in the command-line?

    @nass It will take those bots, 7 septillion years to find my password.

  • penguintutor.com/linux/useradmin-reference

    Excerpt:

    su (Switch User)

    One of the features of Linux is the ability to change userid when logged into a system. This command su is sometimes referred to as superuser , however this is not completely correct. In the early days of UNIX it was only possible to change to the root user, which made for the superuser command however it is now possible to change to any user using the su command. It is more correct to refer to the command as the switch user command.

    The switch user command su is used to change between different users on a system, without having to logout. The most common use is to to change to the root user, but it can be used to switch to any user depending upon the users settings. To switch to a different user other than root, then the username is used as the last option on the command.

    It is also possible to change to another user by putting the username after the su command. There are two ways of switching users. By putting a '-' after the command will cause the users profile to be read and variables to be set. Without the '-' the previous users settings will still remain.

    To use the new users profile and variables

    su - username
    

    To continue with the current profile and variables

    su username
    

    you can then return to the previous user by entering exit.

    -Always Take the issue of safety first, so the same would be correct to disconnect and return the system to the correct user, the 'su' command will not le give the desired security for the system because you still remain as' Root 'and even security must want to leave this user and return to the correct user.

    @PauloMaia I don't understand what you mean? Did you read the question? I just want to change from `root` to normal-user on a system which I have and active terminal session running. This question got alot of down-votes so I found out how to do it and this answers my question. It's simple `su` lets me change users and your not the first to mention security which I still don't understand the relevance to this.

    yes! you change from root to another user but to the system you continues like root and this is not secure because the security need be first, with this you think change 'or think changed of the usr but not changed!'.

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM