Last active
July 2, 2020 18:07
-
-
Save ngtrieuvi92/952678665ecf608e96c9fb2829659609 to your computer and use it in GitHub Desktop.
Adduser with sudo permission
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # I. Run this command on your server | |
| # 1. Create new User | |
| adduser your_user | |
| # 2. Add to sudo group | |
| sudo usermod -aG sudo your_user | |
| # 3. Allow to use sudo without password | |
| echo 'your_user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | |
| # II. Run this command on your compute | |
| # 1. Set authorized_keys for your_user to allow ssh with ssh_key, your_private_key and your_public_key should at the same directory | |
| ssh-copy-id -i your_private_key your_user@your_server_ip | |
| # 2. Add infomation to ssh config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment