• Books
  • Movies
  • Sports
    • Football
    • Hockey
  • Tech
    • Apps
    • Networking
    • Virtualization
    • Linux
      • CentOS
      • Ubuntu
    • MacOS
    • Microsoft
  • Recipes
  • Family
  • About
  • Home.Lab Project
    • Home.Lab Hardware
      • Storage CentOS Server (Phoenix)
      • Centos Hypervisor (Cyclops)
      • CentOS Hypervisor (Wolverine)
      • Homegrown SuperMicro ESXi Hypervisor (Deadpool)
    • Networking
      • Hypervisor Network
      • Juniper SSG5 Configuration
      • Security Zone Configuration
    • Virtual Machines
      • Black Widow (RHEL 6.4)
    • Hypervisor Technologies
    • Tutorials
      • Creating an iSCSI Target in CentOS 6.4
      • Managing Linux Hypervisors through Windows
Home » Tech » Linux » CentOS » Switching the default user when using SSH

Switching the default user when using SSH

Posted on July 27, 2016 by Vitaly Posted in CentOS, Linux, Ubuntu

By default, when creating a new linux worstation, the default username will always be used if you choose to ssh to another machine, unless you wanted to use the username@server method or -l switch and add the username. However you can simply add a configuration option to your ./ssh folder which will always use specific accounts for servers. In my case, since all of our internal servers run as root, it’s easier for me to login as root rather than typing root@ everytime, since my workstation account is username vitaly.

To create a default username for SSH, goto you ~/.ssh folder, and modify (or create) a file called config. In my case, so that all ssh commands use root instead vitaly, I would enter:

Host *
   User root

If you wanted specific accounts for specific servers, you would enter something like:

Host example
    HostName example.net
    User root

Host wordpress
    Hostname wordpress.net
    User myaccount

In the above case, you would simply type ‘ssh wordpress’ and the server would respond with ‘ssh myaccount@wordpress.net.‘

« X-Men Apocalypse Movie Review
Using RealVNC in Windows to connect to a KVM session »

Leave a comment Cancel reply

Your email address will not be published. Required fields are marked *

Around the Way

July 2016
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031
« Jun   Aug »

Recent Posts

  • Getting spice client console working in Virt-Manager for Mint 19
  • Using RealVNC in Windows to connect to a KVM session
  • Switching the default user when using SSH
  • X-Men Apocalypse Movie Review
  • Getting Virt-Manager working in Ubuntu 16.04 LTS bypassing openssh-askpass

Old School

  • September 2018
  • August 2016
  • July 2016
  • June 2016
  • April 2016
  • February 2016
  • January 2016
  • August 2013
  • July 2013
  • April 2013
  • February 2013
  • December 2012
  • November 2012

Archives

  • September 2018
  • August 2016
  • July 2016
  • June 2016
  • April 2016
  • February 2016
  • January 2016
  • August 2013
  • July 2013
  • April 2013
  • February 2013
  • December 2012
  • November 2012

Recent Posts

  • Getting spice client console working in Virt-Manager for Mint 19
  • Using RealVNC in Windows to connect to a KVM session
  • Switching the default user when using SSH
  • X-Men Apocalypse Movie Review
  • Getting Virt-Manager working in Ubuntu 16.04 LTS bypassing openssh-askpass
© Chubby Apple