opendigital / opendigital-org

OpenDigital Docs and Org
3 stars 1 forks source link

Add Brittney into Tower Access #17

Closed jialincheoh closed 1 year ago

jialincheoh commented 1 year ago
  1. create access for Brittney to tower
  2. create a txt file with the instructions for Brittany
  3. share it with secure data transmission (not email).

To add users

sudo adduser username

To create users with admin rights

sudo usermod -aG sudo username

Verify if user is added

$ cat /etc/passwd
$ grep '^brittney' /etc/passwd

Relevant links: https://linuxize.com/post/how-to-create-users-in-linux-using-the-useradd-command/

sbrunswi commented 1 year ago

Here this is the instructions we want to send (this is a fake example)

NEW SERVER USER SSH INSTRUCTIONS

HOW TO CREATE A NEW SSH KEY

ssh-keygen -t rsa -b 4096 -o -a 100 -C <user>@<hostname>

YOUR SSH KEY USERNAME

sbrunswi

YOUR SSH KEY PASSWORD

2EbYaMRhMV8gQttt

Note: Store this somewhere safe and don\'t rely on this file as a permanent solution.

ADD THE SSH-KEY TO YOUR SSH-AGENT KEYRING

**THIS STEP IS REQUIRED**

ssh-add /<path>/<to>/<keyfile>
> Enter passphrase for id_username_hostname: __

Identity added: id_username_hostname (username@hostname)

UPDATE YOUR SSH CONFIG

You can also set these parameters using commandline flags

(refer to ssh manual man ssh for instructions)

### ~/.ssh/config
Host ironhub
  Hostname 142.93.60.97
  User <username>
  IdentityFile /home/<username>/.ssh/id_<username>_<hostname>

CONNECT TO THE SERVER

ssh ironhub
jialincheoh commented 1 year ago

reference article to add users for key based access -> https://thucnc.medium.com/how-to-create-a-sudo-user-on-ubuntu-and-allow-ssh-login-20e28065d9ff

jialincheoh commented 1 year ago

Name: Brittany Green Email: brittany.green.1@louisville.edu Phone: (502)852-4787

jialincheoh commented 1 year ago

Steps to create SSH keys

ssh-keygen

U already have ssh keys do

ssh-keygen -p -f ~/.ssh/id_rsa 

Copy ssh keys into remote server

ssh-copy-id jialincheoh@128.46.86.105 

Create new user account

$ sudo adduser newuser

Switch to the new user account

$ su - newuser

Add public key to allow remote SSH login for the new user

  1. Switch to the new user account
$ su - newuser
  1. Create .ssh folder in home directory
$ mkdir ~/.ssh

And paste your SSH public key here, save and close file

  1. Create authorized_keys file in side the .ssh folder and add the public key

Use your favorite text editor for this. I use vim here, for example:

$ vim ~/.ssh/authorized_keys
  1. Verify SSH remote login

Open another terminal on your machine and try to remote SSH login using new user.

$ ssh newuser@server_address

This should work if you have your SSH private key in ~/.ssh/id_rsa file, otherwise you must specify the path to your private key with -i option:

$ ssh -i path_to_your_ssh_private_key newuser@server_address

Finally download the key from the remote server and pass it to the relevant person.

scp brittany@128.46.86.105:/.ssh/id_rsa .
sbrunswi commented 1 year ago

@jialincheoh - This is taken care off! However, we need a new issue on documentation of admin process!