Create User on CentOS
- CentOS7 64 bit
- CentOS7 32 bit
- CentOS6 32 bit
VIEW TUTORIAL LINK above ^
$ adduser username
Add User to Sudoers File.
TODO: explain what the sudoers file is.
1) Open /etc/sudoers file. visudo uses vim to open the /etc/sudoers
Find the following section and add the user just below root liks so. Replace
<username> with the actual user name
## Next comes the main part: which users can run what software on ## which machines (the sudoers file can be shared between multiple ## systems). ## Syntax: ## ## user MACHINE=COMMANDS ## ## The COMMANDS section may have other options added to it. ## ## Allow root to run any commands anywhere root ALL=(ALL) ALL <username> ALL=(ALL) ALL
$ su - <username>
- Remove the user.
It’s just one simple command to delete a user. In this case, we’re removing a user called mynewuser:
$ userdel <username>
If you want to remove all the files for the user, then use -r:
$ userdel -r mynewuser
- Remove user’s root Privileges
Visudo uses vim to update the users file.
Find the following snippet:
## Allow root to run any commands anywhere root ALL=(ALL) ALL <username> ALL=(ALL) ALL
Delete the following line:
<username> ALL=(ALL) ALL
ESC and type
:wq and hit
ENTER to save and exit the configuration file.
- 2020.06.10 Created file
Add User to Sudoers Filesection