user6502167 user6502167 - 1 month ago 4x
Bash Question

How to change the default user name for shell in Mac OS

I have my Mac setup with username XXX.
And when I do my job, I need to ssh/scp to a remote server with username YYY (I use item2 and bash shell)

It's really annoying to specify the username YYY@hostname each time I login to the workstation, since the YYY is long (12 chars).

Is there any solution to change/specify the default user name from XXX to YYY of the item2/shell, without changing my Mac username?


Sure, go to $HOME/.ssh and edit your ssh config file - it is called config, then add something like this:

User YYY

Replace all the upper case parts. Then you can just do:

ssh server