Home aws, linux, others how to create user and disable user in aws vps
awslinuxothers

how to create user and disable user in aws vps

How to Disable user to access aws vps on ssh

sudo nano /etc/ssh/sshd_config

add this line:
#ronny - to disable user access through ssh
Match User programmer
        ChrootDirectory /var/www/kunci

and finally, use these command to restart ssh
sudo systemctl restart sshd

How to Add user to access aws vps on ssh

  • Access to your AWS Console
  • Goto EC2
  • Click Key Pairs on Network & Security on the left
  • Create Key Pair, for example: support
pick .pem file, and click create key pair
  • after you click the “create key pair” button, you will shown a download window for this pem file, keep this file secure because we cannot download again the same pem file.
  • type these command to make it secure
sudo chmod 400 support.pem
ssh-keygen -y -f support.pem
  • using ssh-keygen will encrypt the RSA, copy it to ssh file on aws vps (remember to copy the result on secure files)
  • goto your vps
sudo adduser support --disabled-password
sudo su - support
mkdir .ssh
chmod 700 .ssh
touch .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
nano .ssh/authorized_keys
  • paste the “ssh-rsa” on this file
  • you can try to access using this command
ssh -i "support.pem" support@[your aws server]

How to find your aws server name

 

Author

Ronny

Leave a Reply