How to create additional User on Oracle Compute instance (Linux/Window)

When we create the Oracle Compute instance (Linux/Window), by default OPC user is created and it has sudo privileges on linux and add user account privileges on Windows instance

To create an additional SSH-enabled user on Linux Compute instance

1.Generate an SSH key pair for the new user.

How to generate ssh key pair on Unix using ssh-keygen

How to Use Puttygen on Windows for key generation

  1. Copy the public key value to a text file for use later in this procedure.

  2. Log in to your instance using the OPC user

  3. Become the root user:

sudo su

  1. Create the new user:

useradd <new_user>

  1. Create a .ssh directory in the new user’s home directory:

mkdir /home/<new_user>/.ssh

  1. Copy the SSH public key that you saved to a text file into the /home/new_

user/.ssh/authorized_keys file:

echo <public_key> > /home/<new_user>/.ssh/authorized_keys

  1. Change the owner and group of the /home/username/.ssh directory to the new user:

chown -R <new_user>:<group> /home/<new_user>/.ssh

  1. To enable sudo privileges for the new user, run the vi sudo command and edit the

/etc/sudoers file as follows:

In /etc/sudoers, look for:

%<username> ALL=(ALL) NOPASSWD: ALL

Add the following line immediately after the preceding line:

%<group> ALL=(ALL) NOPASSWD: ALL

 

Creating Additional Users on a Windows Instance

  1. Log in to your instance using a Remote Desktop client.
  2. On the Start menu, click Control Panel.
  3. Click User Accounts, and then click User Accounts again.
  4. Click Manage User Accounts.
  5. Click Manage Another Account.
  6. Click Add User Account.
  7. Enter a User name and Password.
  8. Confirm the password, and then create a Password hint.
  9. Click Next.
  10. Verify the account, and then click Finish.

You can now log in as the new user.

Leave a Reply