How to access caller of command from from server?

I spawn a ship object using a command and want my player have ship as a property, but I can’t access player from server.

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;

namespace Assets._Scripts
{
    public class PlayerController : NetworkBehaviour
    {
        public GameObject ShipPrefab;
        public GameObject Ship;

        void Start()
        {
            if (!isLocalPlayer)
                return;

            CmdCreateShip(netId);

        }

        void Update()
        {
            if (!isLocalPlayer)
                return;

            var shipController = Ship.GetComponent<ShipController>();

            if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W))
                shipController.CmdAdvance();

        }

        [Command]
        private void CmdCreateShip(NetworkInstanceId id)
        {
            var ship = Instantiate(ShipPrefab);
            NetworkServer.SpawnWithClientAuthority(ship, connectionToClient);
        }
    }
}

A client can only call commands on objects they have authority over. So the object this command is sent to has to belong to the client that has send the command. So just check NetworkIdentity.clientAuthorityOwner.

If you actually sending the command from the player object of a client (which is the usual case in 90% of all cases) you can also use NetworkIdentity.connectionToClient to get the connection and NetworkIdentity.playerControllerId to get the controller ID of the owning player. Note that the “playerControllerId” is basically the index into the playerControllers list