SSH as a different user on remote linux box
You are sat at a linux box (ubuntu, fedora, suse etc) and want to ssh into another linux box (probably your webserver). By default typing ssh remote-domain.com will attempt to log you in as the user you are currently logged in as. However, you may want to log into the remote machine as someone else.
in a linux terminal enter
Digging into the linux world as a traditional windows user can be hit and miss. When working through IT puzzles I have always figured that if I can think of the need then someone somewhere will have figured away to do it and all I need to do is to figure how to ask Google the right question.
With linux things are slightly different. It is almost as if there is some unwritten linux user constitution that says that when explaining the solution to a problem they will only give the vaguest clues and insinuations. It is as if actually spelling out in plain English the answer to a problem would be ‘too easy’. Heck, I am surprised that some of the answers are not in anagrams just to make things hard.
After trying various google searches the answer was eventually half way down the second page.
In Windows the usual way to ssh into a server is via Putty and this is probably the cause of the frustration. In putty you give the remote domain you want to connect to and when the connection is made you are asked for a user name and password. IT MAKES SENSE!!. On a linux box (ubuntu trying to connect to CentOS in my case) it assumes you want to connect the remote computer using the username you are currently logged in as. Why? I mean what are the changes of two computers expecting the same username?
As with many linux problem-answer combos the answer is easy.. once you know how. Part of the reason I stated this blog was to stick info like this somewhere so the next time I forger I know where to look and help others who are in the same situation. As always if you find somthing useful check out the sponsors