Skip to main content

How to add users to your AWS EC2 Linux instance

Do you need to add more users to your AWS EC2 Linux instance? This is a step-by-step tutorial to guide you through the basic process.

1) Open a terminal session and navigate to the path where you have your-key-pair.pem file

2) Type the following command in order to extract the public key from your key pair
ssh-keygen -y -f your-key-pair.pem
3) You will get as a response a string like the one below. Copy it to your clipboard.
ssh-rsa AAAAB3NzaC1yVh0/ThkcfO479gFjMUVw48D2Pi4u0P+0lvP0tpzKcZ/nwnzhFIDyUHsVKMN0F97DCoPQEbk5jmyHRSBok+cuEXAMPLEt1VI7TLSAwWZj5aRedb+awFDLxBgS8SN/nvsaP4+KY8uGum10YV83/wGNZjYEVRLg9NjyDbuVERYFAKEhscyZAbWTMw2t30JELizxyXZx4s4OImfS4yOCnDLFgHFf3JUjGhTUg1O+10I3V2TB3j63166AEB+98JizrRtwJ85AUN/wmMD0V2YIiEaa2rMLbdGZw8lSlPakV3bedx+8NYf+s2+SLwB
4) Login with your ec2-user to your instance, as usual.
ssh -i your-key-pair.pem ec2-user@yourawspublicip
5) Create a Linux user account on the EC2 instance
sudo adduser username
6) OPTIONAL: Only if you want to give this user sudo access, do the following:
  • Switch to root: sudo su -
  • Open sudo config file: visudo
  • Add this line to the commands section: username  ALL=(ALL)  NOPASSWD:ALL

7) Switch to the user you have just created
sudo su - username
8) Create a .ssh directory
mkdir .ssh
9) Change permissions of this directory
chmod 700 .ssh
10) Create a new file authorized_keys in this directory and paste the public key that you have on your clipboard. Make sure that it doesn't miss the first letter.
vi .ssh/authorized_keys
11) Change permissions of this file
chmod 600 .ssh/authorized_keys
12) Send your-key-pair.pem file to the new user. She will be able to connect to the EC2 instance running the following command from the same folder where she has placed your-key-pair.pem file.
ssh -i your-key-pair.pem username@yourawspublicip
13) If thy get public key error, make sure they give the right permissions to your-key-pair.pem.
    chmod 600 your-key-pair.pem

Popular posts from this blog

How to disable cookies on Google Analytics so that you don't need a consent banner

The integration of Google Analytics into a website or blog is not GDPR-compliant by default . You must first obtain explicit consent of the end-users to store cookies, describing in your privacy policy how you intend to use collected personal data. This is the reason why most websites nowadays display an annoying (but necessary) consent banner. If you fail to do so or if you only ask for implicit consent, you are at risk of being fined. However, it is possible to disable cookies on Google Analytics (GA) respecting end-users privacy, so that you don't need to ask for consent. The downside is that you will not be able to distinguish the type of user (unique vs new vs returning) and you will miss some session insights. If these details are not relevant for you, here is how you do it. Disable Google Analytics cookies on a custom website If you have a custom website with full access to the source code, you can simply insert the script below between the <head>  and </head>

How to jump to time offsets in HTML5 video

Let's say that you have a 30-minute WEBM video file, from which you just want to play the following video segments , jumping from one to the other automatically  without interruptions : [00:01:25.00 - 00:02:25.00] -> from second 85 to 145 [00:11:40.00 - 00:11:55.00] -> from second 700 to 715 [00:20:26.00 - 00:21:07.00] -> from second 1226 to 1267 [00:26:11.00 - 00:28:01.00] -> from second 1571 to 1681 To increase the complexity, let's think that you have these video segments in a PHP variable $arrayVideoSegments  (normally the case if they were retrieved from the database).   $arrayVideoSegments[0]->startTime = 85   $arrayVideoSegments[0]->endTime = 145   $arrayVideoSegments[1]->startTime = 700   $arrayVideoSegments[1]->endTime = 715   $arrayVideoSegments[2]->startTime = 1226   $arrayVideoSegments[2]->endTime = 1267   $arrayVideoSegments[3]->startTime = 1571   $arrayVideoSegments[3]->endTime = 1681 The fo

Temario del curso "Startup Innovation Lab"

En 2017 publiqué, en el marco del curso Startup Innovation Lab , este vídeo explicando el Lean Canvas en español usando Spotify como ejemplo ilustrativo.  Me ha sorprendido muy gratamente comprobar que, cinco a ñ os después, el vídeo se acerca a las 100.000 reproducciones. Algunas personas me han escrito preguntando dónde pueden acceder al resto de materiales del curso. El curso ya no se imparte, pero he decidido publicar el temario completo en PDF por si fuese de utilidad. En total son 10 módulos  que cubren distintas temáticas sobre la puesta en marcha de ideas de negocio innovadoras. 1. Introducción a Lean Startup 2. Lean Canvas y Business Model Canvas 3. Métricas de Negocio 4. Estudio de Mercado 5. Producto Mínimo Viable 6. Constitución de la Empresa 7. Fuentes de Financiación 8. Modelo de Ingresos y Plan Financiero 9. Plan de Negocio 10. Pitch de Presentación del Negocio Tengan en cuenta que este contenido no ha sido actualizado desde su creación en 2017 y se ofrece si