With drush: drush php-eval 'echo(drupal_random_key()) . PHP_EOL;' With openssl: openssl rand -base64 32