Home > Net >  Linux CentoOS wont accept my password for sudo
Linux CentoOS wont accept my password for sudo

Time:03-16

So I am working on this project in a CentOS virtual machine.

These are the instruction I have for the project:

Three users need to share files on the system, but no other user can have access to these files. Create user accounts for sophia, olivia, and emma, using default values for account parameters. Create a common group named shared, which will be used to allow these three users to share files with each other. Finally, create a directory named /home/shared for only these three users to access and to also automatically give group ownership of all new files to the shared group.

I also have a broken down instruction manual that tells me how to accomplish the project, and these are the commands it tells me to use to accomplish the project:

$ for name in “sophia” “olivia” “emma”
> do
> sudo useradd $name
> done
$ for name in “sophia” “olivia” “emma”
> do
> sudo passwd $name
> done
$ sudo groupadd shared
$ for name in “sophia” “olivia” “emma”
> do
> sudo usermod -a -G shared $name
> done
$ sudo mkdir /home/shared
$ sudo chgrp shared /home/shared
$ sudo chmod 660 /home/shared
$ sudo chmod g s /home/shared

My issue is that whenever I try to use the sudo command it asks for a password, and if i try the root password or my login password it says this:

CentOS

I have no idea what the password is if its not my root or login password. Any help would be extremely useful. Thank you!

CodePudding user response:

you are not allowed to sudo. You have been given the root password, you can do 2 things:

  1. use su to switch to root
  2. then add your login to the sudoers list. And then sudo would work.

CodePudding user response:

If you have the root password, you can log in as root with the su command. If you want to use sudo as the user, add yourself to list of sudoers or yourself to the wheel group: usermod -aG wheel username

More information on the latter two things here: https://linuxize.com/post/how-to-add-user-to-sudoers-in-centos/

  • Related