When we create the Oracle Compute instance (Linux/Window), by default OPC user is created and it has sudo privileges on Linux and adds 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
(2) Copy the public key value to a text file for use later in this procedure.
(3) Log in to your instance using the OPC user
(4) Become the root user:
sudo su
- Create the new user:
useradd <new_user>
- Create a .ssh directory in the new user’s home directory:
mkdir /home/<new_user>/.ssh
- 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
- Change the owner and group of the /home/username/.ssh directory to the new user:
chown -R <new_user>:<group> /home/<new_user>/.ssh
- 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
- Log in to your instance using a Remote Desktop client.
- On the Start menu, click Control Panel.
- Click User Accounts, and then click User Accounts again.
- Click Manage User Accounts.
- Click Manage Another Account.
- Click Add User Account.
- Enter a User name and Password.
- Confirm the password, and then create a Password hint.
- Click Next.
- Verify the account, and then click Finish.
You can now log in as a new user.