diff --git a/core/lib/Drupal/Core/Entity/EditorialContentEntityBase.php b/core/lib/Drupal/Core/Entity/EditorialContentEntityBase.php
index ff6abcd..2a3b9b6 100644
--- a/core/lib/Drupal/Core/Entity/EditorialContentEntityBase.php
+++ b/core/lib/Drupal/Core/Entity/EditorialContentEntityBase.php
@@ -10,6 +10,7 @@
 abstract class EditorialContentEntityBase extends ContentEntityBase implements EntityChangedInterface, EntityPublishedInterface, RevisionLogInterface {
 
   use EntityChangedTrait;
+  use EntityOwnerTrait;
   use EntityPublishedTrait;
   use RevisionLogEntityTrait;
 
@@ -22,6 +23,9 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
     // Add the revision metadata fields.
     $fields += static::revisionLogBaseFieldDefinitions($entity_type);
 
+    // Add the owner field.
+    $fields += static::ownerBaseFieldDefinitions($entity_type);
+
     // Add the published field.
     $fields += static::publishedBaseFieldDefinitions($entity_type);
 
diff --git a/core/lib/Drupal/Core/Entity/EntityOwnerTrait.php b/core/lib/Drupal/Core/Entity/EntityOwnerTrait.php
new file mode 100644
index 0000000..f2fd8ba
--- /dev/null
+++ b/core/lib/Drupal/Core/Entity/EntityOwnerTrait.php
@@ -0,0 +1,89 @@
+<?php
+
+namespace Drupal\Core\Entity;
+
+use Drupal\Core\Entity\Exception\UnsupportedEntityTypeDefinitionException;
+use Drupal\Core\Field\BaseFieldDefinition;
+use Drupal\Core\StringTranslation\TranslatableMarkup;
+use Drupal\user\EntityOwnerInterface;
+use Drupal\user\UserInterface;
+
+/**
+ * Provides a trait for entity owners.
+ */
+trait EntityOwnerTrait {
+
+  /**
+   * Returns an array of base field definitions for entity owners.
+   *
+   * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
+   *   The entity type to add the owner field to.
+   *
+   * @return \Drupal\Core\Field\BaseFieldDefinition[]
+   *   An array of base field definitions.
+   *
+   * @throws \Drupal\Core\Entity\Exception\UnsupportedEntityTypeDefinitionException
+   *   Thrown when the entity type does not have a "uid" entity key.
+   */
+  public static function ownerBaseFieldDefinitions(EntityTypeInterface $entity_type) {
+    if (!is_subclass_of($entity_type->getClass(), EntityOwnerInterface::class)) {
+      return [];
+    }
+
+    if (!$entity_type->hasKey('uid')) {
+      throw new UnsupportedEntityTypeDefinitionException('The entity type ' . $entity_type->id() . ' does not have a "uid" entity key.');
+    }
+
+    return [
+      $entity_type->getKey('uid') => BaseFieldDefinition::create('entity_reference')
+        ->setLabel(new TranslatableMarkup('User ID'))
+        ->setSetting('target_type', 'user'),
+    ];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getOwnerId() {
+    return $this->getEntityKey('uid');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setOwnerId($uid) {
+    $key = $this->getEntityType()->getKey('uid');
+    $this->set($key, $uid);
+
+    return $this;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getOwner() {
+    $key = $this->getEntityType()->getKey('uid');
+    return $this->get($key)->entity;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setOwner(UserInterface $account) {
+    $key = $this->getEntityType()->getKey('uid');
+    $this->set($key, $account->id());
+
+    return $this;
+  }
+
+  /**
+   * Default value callback for 'uid' base field definition.
+   *
+   * @return array
+   *   An array of default values.
+   */
+  public static function getCurrentUserId() {
+    return [\Drupal::currentUser()->id()];
+  }
+
+}
diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install
index c244fe4..3cb5968 100644
--- a/core/modules/comment/comment.install
+++ b/core/modules/comment/comment.install
@@ -195,3 +195,16 @@ function comment_update_8400() {
   $entity_definition_update_manager = \Drupal::service('entity.definition_update_manager');
   $entity_definition_update_manager->updateFieldStorageDefinition($entity_definition_update_manager->getFieldStorageDefinition('status', 'comment'));
 }
+
+/**
+ * Set the 'uid' entity key and update the field.
+ */
+function comment_update_8600() {
+  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
+  $entity_type = $definition_update_manager->getEntityType('comment');
+  $keys = $entity_type->getKeys();
+  $keys['uid'] = 'uid';
+  $entity_type->set('entity_keys', $keys);
+  $definition_update_manager->updateEntityType($entity_type);
+  $definition_update_manager->updateFieldStorageDefinition($definition_update_manager->getFieldStorageDefinition('uid', 'comment'));
+}
diff --git a/core/modules/comment/src/Entity/Comment.php b/core/modules/comment/src/Entity/Comment.php
index 5f5a611..97a285c 100644
--- a/core/modules/comment/src/Entity/Comment.php
+++ b/core/modules/comment/src/Entity/Comment.php
@@ -7,13 +7,13 @@
 use Drupal\Core\Entity\ContentEntityBase;
 use Drupal\comment\CommentInterface;
 use Drupal\Core\Entity\EntityChangedTrait;
+use Drupal\Core\Entity\EntityOwnerTrait;
 use Drupal\Core\Entity\EntityPublishedTrait;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Field\BaseFieldDefinition;
 use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\user\Entity\User;
-use Drupal\user\UserInterface;
 
 /**
  * Defines the comment entity class.
@@ -52,6 +52,7 @@
  *     "langcode" = "langcode",
  *     "uuid" = "uuid",
  *     "published" = "status",
+ *     "uid" = "uid"
  *   },
  *   links = {
  *     "canonical" = "/comment/{comment}",
@@ -70,6 +71,7 @@
 class Comment extends ContentEntityBase implements CommentInterface {
 
   use EntityChangedTrait;
+  use EntityOwnerTrait;
   use EntityPublishedTrait;
 
   /**
@@ -225,6 +227,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
     /** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
     $fields = parent::baseFieldDefinitions($entity_type);
     $fields += static::publishedBaseFieldDefinitions($entity_type);
+    $fields += static::ownerBaseFieldDefinitions($entity_type);
 
     $fields['cid']->setLabel(t('Comment ID'))
       ->setDescription(t('The comment ID.'));
@@ -260,11 +263,9 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
       ])
       ->setDisplayConfigurable('form', TRUE);
 
-    $fields['uid'] = BaseFieldDefinition::create('entity_reference')
-      ->setLabel(t('User ID'))
+    $fields['uid']
       ->setDescription(t('The user ID of the comment author.'))
       ->setTranslatable(TRUE)
-      ->setSetting('target_type', 'user')
       ->setDefaultValue(0);
 
     $fields['name'] = BaseFieldDefinition::create('string')
@@ -528,29 +529,6 @@ public function getOwner() {
   }
 
   /**
-   * {@inheritdoc}
-   */
-  public function getOwnerId() {
-    return $this->get('uid')->target_id;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setOwnerId($uid) {
-    $this->set('uid', $uid);
-    return $this;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setOwner(UserInterface $account) {
-    $this->set('uid', $account->id());
-    return $this;
-  }
-
-  /**
    * Get the comment type ID for this comment.
    *
    * @return string
diff --git a/core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php b/core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php
index e623132..671bd90 100644
--- a/core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php
+++ b/core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php
@@ -71,4 +71,22 @@ public function testPublishedEntityKey() {
     $this->assertTrue(\Drupal::database()->schema()->indexExists('comment_field_data', 'comment__status_comment_type'));
   }
 
+  /**
+   * Tests that the comment entity type has a 'uid' entity key.
+   *
+   * @see comment_update_8600()
+   */
+  public function testUidEntityKey() {
+    // Check that the 'uid' entity key does not exist prior to the update.
+    $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('comment');
+    $this->assertFalse($entity_type->getKey('uid'));
+
+    // Run updates.
+    $this->runUpdates();
+
+    // Check that the entity key exists and it has the correct value.
+    $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('comment');
+    $this->assertEqual('uid', $entity_type->getKey('uid'));
+  }
+
 }
diff --git a/core/modules/content_moderation/src/Entity/ContentModerationState.php b/core/modules/content_moderation/src/Entity/ContentModerationState.php
index abb92eb..2de6403 100644
--- a/core/modules/content_moderation/src/Entity/ContentModerationState.php
+++ b/core/modules/content_moderation/src/Entity/ContentModerationState.php
@@ -4,10 +4,10 @@
 
 use Drupal\Core\Entity\ContentEntityBase;
 use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityOwnerTrait;
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Field\BaseFieldDefinition;
 use Drupal\Core\TypedData\TranslatableInterface;
-use Drupal\user\UserInterface;
 
 /**
  * Defines the Content moderation state entity.
@@ -48,16 +48,18 @@
  */
 class ContentModerationState extends ContentEntityBase implements ContentModerationStateInterface {
 
+  use EntityOwnerTrait;
+
   /**
    * {@inheritdoc}
    */
   public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
     $fields = parent::baseFieldDefinitions($entity_type);
+    $fields += static::ownerBaseFieldDefinitions($entity_type);
 
-    $fields['uid'] = BaseFieldDefinition::create('entity_reference')
+    $fields['uid']
       ->setLabel(t('User'))
       ->setDescription(t('The username of the entity creator.'))
-      ->setSetting('target_type', 'user')
       ->setDefaultValueCallback('Drupal\content_moderation\Entity\ContentModerationState::getCurrentUserId')
       ->setTranslatable(TRUE)
       ->setRevisionable(TRUE);
@@ -99,36 +101,6 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
   }
 
   /**
-   * {@inheritdoc}
-   */
-  public function getOwner() {
-    return $this->get('uid')->entity;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getOwnerId() {
-    return $this->getEntityKey('uid');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setOwnerId($uid) {
-    $this->set('uid', $uid);
-    return $this;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setOwner(UserInterface $account) {
-    $this->set('uid', $account->id());
-    return $this;
-  }
-
-  /**
    * Creates or updates an entity's moderation state whilst saving that entity.
    *
    * @param \Drupal\content_moderation\Entity\ContentModerationState $content_moderation_state
@@ -181,18 +153,6 @@ public static function loadFromModeratedEntity(EntityInterface $entity) {
   }
 
   /**
-   * Default value callback for the 'uid' base field definition.
-   *
-   * @see \Drupal\content_moderation\Entity\ContentModerationState::baseFieldDefinitions()
-   *
-   * @return array
-   *   An array of default values.
-   */
-  public static function getCurrentUserId() {
-    return [\Drupal::currentUser()->id()];
-  }
-
-  /**
    * {@inheritdoc}
    */
   public function save() {
diff --git a/core/modules/file/file.install b/core/modules/file/file.install
index 6274efc..5b6268e 100644
--- a/core/modules/file/file.install
+++ b/core/modules/file/file.install
@@ -164,3 +164,16 @@ function file_update_8001() {
     }
   }
 }
+
+/**
+ * Set the 'uid' entity key and update the field.
+ */
+function file_update_8600() {
+  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
+  $entity_type = $definition_update_manager->getEntityType('file');
+  $keys = $entity_type->getKeys();
+  $keys['uid'] = 'uid';
+  $entity_type->set('entity_keys', $keys);
+  $definition_update_manager->updateEntityType($entity_type);
+  $definition_update_manager->updateFieldStorageDefinition($definition_update_manager->getFieldStorageDefinition('uid', 'file'));
+}
diff --git a/core/modules/file/src/Entity/File.php b/core/modules/file/src/Entity/File.php
index 4060b77..cf68163 100644
--- a/core/modules/file/src/Entity/File.php
+++ b/core/modules/file/src/Entity/File.php
@@ -4,11 +4,11 @@
 
 use Drupal\Core\Entity\ContentEntityBase;
 use Drupal\Core\Entity\EntityChangedTrait;
+use Drupal\Core\Entity\EntityOwnerTrait;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Field\BaseFieldDefinition;
 use Drupal\file\FileInterface;
-use Drupal\user\UserInterface;
 
 /**
  * Defines the file entity class.
@@ -29,13 +29,15 @@
  *     "id" = "fid",
  *     "label" = "filename",
  *     "langcode" = "langcode",
- *     "uuid" = "uuid"
+ *     "uuid" = "uuid",
+ *     "uid" = "uid"
  *   }
  * )
  */
 class File extends ContentEntityBase implements FileInterface {
 
   use EntityChangedTrait;
+  use EntityOwnerTrait;
 
   /**
    * {@inheritdoc}
@@ -112,36 +114,6 @@ public function getCreatedTime() {
   /**
    * {@inheritdoc}
    */
-  public function getOwner() {
-    return $this->get('uid')->entity;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getOwnerId() {
-    return $this->get('uid')->target_id;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setOwnerId($uid) {
-    $this->set('uid', $uid);
-    return $this;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setOwner(UserInterface $account) {
-    $this->set('uid', $account->id());
-    return $this;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function isPermanent() {
     return $this->get('status')->value == FILE_STATUS_PERMANENT;
   }
@@ -225,6 +197,7 @@ public static function preDelete(EntityStorageInterface $storage, array $entitie
   public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
     /** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
     $fields = parent::baseFieldDefinitions($entity_type);
+    $fields += static::ownerBaseFieldDefinitions($entity_type);
 
     $fields['fid']->setLabel(t('File ID'))
       ->setDescription(t('The file ID.'));
@@ -234,10 +207,8 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
     $fields['langcode']->setLabel(t('Language code'))
       ->setDescription(t('The file language code.'));
 
-    $fields['uid'] = BaseFieldDefinition::create('entity_reference')
-      ->setLabel(t('User ID'))
-      ->setDescription(t('The user ID of the file.'))
-      ->setSetting('target_type', 'user');
+    $fields['uid']
+      ->setDescription(t('The user ID of the file.'));
 
     $fields['filename'] = BaseFieldDefinition::create('string')
       ->setLabel(t('Filename'))
diff --git a/core/modules/file/src/Tests/Update/FileUpdateTest.php b/core/modules/file/src/Tests/Update/FileUpdateTest.php
index bd724f4..e047cba 100644
--- a/core/modules/file/src/Tests/Update/FileUpdateTest.php
+++ b/core/modules/file/src/Tests/Update/FileUpdateTest.php
@@ -56,4 +56,22 @@ public function testPostUpdate8001() {
     $this->assertEqual($formatter_settings, ['use_description_as_link_text' => FALSE]);
   }
 
+  /**
+   * Tests that the file entity type has a 'uid' entity key.
+   *
+   * @see file_update_8600()
+   */
+  public function testUidEntityKey() {
+    // Check that the 'uid' entity key does not exist prior to the update.
+    $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('file');
+    $this->assertFalse($entity_type->getKey('uid'));
+
+    // Run updates.
+    $this->runUpdates();
+
+    // Check that the entity key exists and it has the correct value.
+    $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('file');
+    $this->assertEqual('uid', $entity_type->getKey('uid'));
+  }
+
 }
diff --git a/core/modules/media/src/Entity/Media.php b/core/modules/media/src/Entity/Media.php
index cca42de..84ba83d 100644
--- a/core/modules/media/src/Entity/Media.php
+++ b/core/modules/media/src/Entity/Media.php
@@ -3,6 +3,7 @@
 namespace Drupal\media\Entity;
 
 use Drupal\Core\Entity\EditorialContentEntityBase;
+use Drupal\Core\Entity\EntityOwnerTrait;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Field\BaseFieldDefinition;
@@ -10,7 +11,6 @@
 use Drupal\media\MediaInterface;
 use Drupal\media\MediaSourceEntityConstraintsInterface;
 use Drupal\media\MediaSourceFieldConstraintsInterface;
-use Drupal\user\UserInterface;
 
 /**
  * Defines the media entity class.
@@ -60,6 +60,7 @@
  *     "langcode" = "langcode",
  *     "uuid" = "uuid",
  *     "published" = "status",
+ *     "uid" = "uid",
  *   },
  *   revision_metadata_keys = {
  *     "revision_user" = "revision_user",
@@ -85,6 +86,7 @@
  */
 class Media extends EditorialContentEntityBase implements MediaInterface {
 
+  use EntityOwnerTrait;
   use StringTranslationTrait;
 
   /**
@@ -133,34 +135,6 @@ public function setCreatedTime($timestamp) {
   /**
    * {@inheritdoc}
    */
-  public function getOwner() {
-    return $this->get('uid')->entity;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setOwner(UserInterface $account) {
-    return $this->set('uid', $account->id());
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getOwnerId() {
-    return $this->get('uid')->target_id;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setOwnerId($uid) {
-    return $this->set('uid', $uid);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function getSource() {
     return $this->bundle->entity->getSource();
   }
@@ -394,6 +368,7 @@ public function validate() {
    */
   public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
     $fields = parent::baseFieldDefinitions($entity_type);
+    $fields += static::ownerBaseFieldDefinitions($entity_type);
 
     $fields['name'] = BaseFieldDefinition::create('string')
       ->setLabel(t('Name'))
@@ -425,12 +400,11 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
       ->setDisplayConfigurable('view', TRUE)
       ->setReadOnly(TRUE);
 
-    $fields['uid'] = BaseFieldDefinition::create('entity_reference')
+    $fields['uid']
       ->setLabel(t('Authored by'))
       ->setDescription(t('The user ID of the author.'))
       ->setRevisionable(TRUE)
       ->setDefaultValueCallback(static::class . '::getCurrentUserId')
-      ->setSetting('target_type', 'user')
       ->setTranslatable(TRUE)
       ->setDisplayOptions('form', [
         'type' => 'entity_reference_autocomplete',
@@ -488,18 +462,6 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
   }
 
   /**
-   * Default value callback for 'uid' base field definition.
-   *
-   * @see ::baseFieldDefinitions()
-   *
-   * @return int[]
-   *   An array of default values.
-   */
-  public static function getCurrentUserId() {
-    return [\Drupal::currentUser()->id()];
-  }
-
-  /**
    * {@inheritdoc}
    */
   public static function getRequestTime() {
diff --git a/core/modules/node/src/Entity/Node.php b/core/modules/node/src/Entity/Node.php
index ccee95b..c9baf53 100644
--- a/core/modules/node/src/Entity/Node.php
+++ b/core/modules/node/src/Entity/Node.php
@@ -8,7 +8,6 @@
 use Drupal\Core\Field\BaseFieldDefinition;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\node\NodeInterface;
-use Drupal\user\UserInterface;
 
 /**
  * Defines the node entity class.
@@ -254,36 +253,6 @@ public function setSticky($sticky) {
   /**
    * {@inheritdoc}
    */
-  public function getOwner() {
-    return $this->get('uid')->entity;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getOwnerId() {
-    return $this->getEntityKey('uid');
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setOwnerId($uid) {
-    $this->set('uid', $uid);
-    return $this;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function setOwner(UserInterface $account) {
-    $this->set('uid', $account->id());
-    return $this;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function getRevisionAuthor() {
     return $this->getRevisionUser();
   }
@@ -319,11 +288,10 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
       ])
       ->setDisplayConfigurable('form', TRUE);
 
-    $fields['uid'] = BaseFieldDefinition::create('entity_reference')
+    $fields['uid']
       ->setLabel(t('Authored by'))
       ->setDescription(t('The username of the content author.'))
       ->setRevisionable(TRUE)
-      ->setSetting('target_type', 'user')
       ->setDefaultValueCallback('Drupal\node\Entity\Node::getCurrentUserId')
       ->setTranslatable(TRUE)
       ->setDisplayOptions('view', [
@@ -405,16 +373,4 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
     return $fields;
   }
 
-  /**
-   * Default value callback for 'uid' base field definition.
-   *
-   * @see ::baseFieldDefinitions()
-   *
-   * @return array
-   *   An array of default values.
-   */
-  public static function getCurrentUserId() {
-    return [\Drupal::currentUser()->id()];
-  }
-
 }
