How to add a user account in Oracle Linux 7

From Computernewb Wiki
Jump to navigation Jump to search

< Convert a CentOS install into Oracle Linux | Configure firewall and SELinux >

Here's how you add other users in Oracle Linux 7:

[root@localhost ~]# useradd newuser
[root@localhost ~]# passwd newuser
Changing password for user newuser.
New UNIX password:             # Input whatever password you want.
Retype New UNIX password:      # Confirm.
passwd: all authentication tokens updated successfully.

You might also need to switch to the root account on occasion, you can use the su command to do this.

localhost login: newuser
password:                      # obviously, put your password here.
[newuser@localhost ~]# su -    # "su" stands for "substitute user", and in this case we are switching to root
password:                      # Enter the root password here.
[root@localhost ~]#

You can delete users like this:

[root@localhost ~]# userdel newuser # deletes the account "newuser". It only removes the user account, not the home directory

# To remove the home directory too, you'd run the command like this:
[root@localhost ~]# userdel -r newuser

< Convert a CentOS install into Oracle Linux | Configure firewall and SELinux >