Managing your Linux VM: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
No edit summary
No edit summary
 
(15 intermediate revisions by 3 users not shown)
Line 2: Line 2:
<translate>
<translate>
<!--T:45-->
<!--T:45-->
The majority of researchers use the Linux Operating System on their VMs.  Common Linux distributions used are AlmaLunix, CentOS, Debian, Fedora, and Ubuntu.  This page will help you with some common tasks to manage your Linux VM.  VMs can also run the Microsoft Windows Operating System.  Some Windows management tasks are described [[Cloud_Quick_Start#Request_access_to_a_Windows_image | here]].
The majority of researchers use the Linux Operating System on their VMs.  Common Linux distributions used are AlmaLunix, CentOS, Debian, Fedora, and Ubuntu.  This page will help you with some common tasks to manage your Linux VM.  VMs can also run the Microsoft Windows operating system.  Some Windows management tasks are described [[Cloud_Quick_Start#Windows | here]].


=Linux VM User Management= <!--T:46-->
=Linux VM user management= <!--T:46-->
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.
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:47-->
==Creating a user account and keys== <!--T:47-->
A new user account can be created on Ubuntu with the command {{Command|sudo adduser --disabled-password USERNAME}} To be able to connect, the new user will need to have a key pair, 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 are correct as described in steps 2 and 3 of [[Using_SSH_keys_in_Linux#Connecting using a Key Pair|connecting using a key pair]].
A new user account can be created on Ubuntu with the command {{Command|sudo adduser --disabled-password USERNAME}} To be able to connect, the new user will need to have a key pair, 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 are correct as described in steps 2 and 3 of [[Using_SSH_keys_in_Linux#Connecting using a key pair|Connecting using a key pair]].


==Granting admin privileges== <!--T:44-->
==Granting admin privileges== <!--T:44-->
In Ubuntu administrative, or root user privliges, can be given to a new user with the command
In Ubuntu, administrative or root user privileges 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
which opens an editor where a line like
  USERNAME ALL=(ALL) NOPASSWD:ALL
  USERNAME ALL=(ALL) NOPASSWD:ALL
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.
can be added. For more detailed information about the <code>visudo</code> 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.
 
==Dealing with system and security issues== <!--T:49-->
See our guides for how to
* [[Recovering_data_from_a_compromised_VM | recover data from a compromised VM]]
* [[VM_recovery_via_cloud_console | recover your VM from the dashboard]]


<!--T:48-->
<!--T:48-->
[[Category:CC-Cloud]]
[[Category:Cloud]]
</translate>
</translate>

Latest revision as of 20:08, 1 May 2023

Other languages:

The majority of researchers use the Linux Operating System on their VMs. Common Linux distributions used are AlmaLunix, CentOS, Debian, Fedora, and Ubuntu. This page will help you with some common tasks to manage your Linux VM. VMs can also run the Microsoft Windows operating system. Some Windows management tasks are described here.

Linux VM user management

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 a user account and keys

A new user account can be created on Ubuntu with the command

Question.png
[name@server ~]$ sudo adduser --disabled-password USERNAME

To be able to connect, the new user will need to have a key pair, see generating SSH keys in Windows or 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 /home/USERNAME/.ssh/authorized_keys on the VM, ensuring permissions and ownership are correct as described in steps 2 and 3 of Connecting using a key pair.

Granting admin privileges

In Ubuntu, administrative or root user privileges can be given to a new user with the command

Question.png
[name@server ~]$ sudo visudo -f /etc/sudoers.d/90-cloud-init-users

which opens an editor where a line like

USERNAME ALL=(ALL) NOPASSWD:ALL

can be added. For more detailed information about the visudo command and how to edit this file see this digitalocean tutorial.

Dealing with system and security issues

See our guides for how to