cc_staff
1,486
edits
No edit summary |
No edit summary |
||
Line 122: | Line 122: | ||
=Accessing a VM with Multiple Users= <!--T:28--> | =Accessing a VM with Multiple Users= <!--T:28--> | ||
[[ | There are a number of ways to allow more than one person to log into a VM. We recommend creating new user accounts and adding public [[SSH Keys]] to these accounts. | ||
==Creating an account and keys== | |||
<!--T:29--> | <!--T:29--> | ||
To add a new user account manually, first create a new user account. For example if you using Ubuntu, the command {{Command|sudo adduser --disabled-password USERNAME}} will create a new user. The new user also needs to have a keypair, see [[Generating_SSH_keys_in_Windows|generating SSH keys in windows]] or [[Using_SSH_keys_in_Linux#Creating a Key Pair|creating a key pair in Linux or Mac]] depending on the operating system they will be connecting from. Then their public key must be added to <code>/home/USERNAME/.ssh/authorized_keys</code> on the VM, ensuring permissions and ownership is correct as described in steps 2 and 3 of [[Using_SSH_keys_in_Linux#Connecting using a Key Pair|connecting using a key pair]]. | |||
Then | |||
==Granting admin privileges== | |||
<!--T:44--> | <!--T:44--> | ||
In Ubuntu administrative, or root user privliges, can be given to a new user with the command | |||
{{Command|sudo visudo -f /etc/sudoers.d/90-cloud-init-users}} | {{Command|sudo visudo -f /etc/sudoers.d/90-cloud-init-users}} | ||
which opens an editor where a line like | |||
USERNAME ALL=(ALL) NOPASSWD:ALL | USERNAME ALL=(ALL) NOPASSWD:ALL | ||
For more detailed information about the visudo command and how to edit this file see this [https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos#what-is-visudo digitalocean] tutorial on the topic. | can be added. For more detailed information about the visudo command and how to edit this file see this [https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos#what-is-visudo digitalocean] tutorial on the topic. | ||
==Add users with CloudInit during VM creation== | |||
[[File:VM multi user cloud init.png|400px|thumb| Cloud init to add multiple users (Click for larger image)]] | |||
<!--T:30--> | <!--T:30--> | ||
Alternatively, you can do this during the creation of a VM using [http://cloudinit.readthedocs.org/en/latest/index.html# CloudInit]. The following CloudInit script adds two users <code>gretzky</code> and <code>lemieux</code> with and without sudo permissions respectively. | Alternatively, you can do this during the creation of a VM using [http://cloudinit.readthedocs.org/en/latest/index.html# CloudInit]. The following CloudInit script adds two users <code>gretzky</code> and <code>lemieux</code> with and without sudo permissions respectively. |