On ubuntu, it is recommanded to do everything under a common user rather than the root user, yes even for administration tasks. This video will show you how to create a common user and give it superuser power, so that you can use this user to run commands that only root user has the permissions to run.
The command is simple.
adduser billie --ingroup sudo
you will see the err:
adduser: Only root may add a user or group to the system.
this fix is adding sudo before the command
sudo adduser billie --ingroup sudo
now you need to type in password for the user billie
, other infomation is optional, type Enter to skip them.
run
su billie
cd
to go to the HOME directory of billie, and we are good to go.
if you want to become root user
sudo su
Cmd-D to quit root and back to user billie
or you can use
su peter
to become peter. So that’s how you switch from different users.
man adduser
then you type /
and search --ingroup
to know more about this option.
BTW, you can use
man userdel
to find out how you can delete a user.
That’s the simple trick I want to share today, plz remember, you use adduser
to create a new user.