Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

SSH Annoyances

Is there a way to disable ssh from sending your Mac OS X username as the ssh connection username, that way the ssh session prompts for the username?

For example; so I can run ' ssh 127.0.0.1' and don't have to run ' ssh user@127.0.0.1' or ' ssh -l user 127.0.0.1'.

Mac OS X (10.4.4)

Posted on Feb 13, 2007 7:54 PM

Reply
2 replies

Feb 13, 2007 9:18 PM in response to Yndoendo

I'm not sure why you prefer entering the username in a prompt vs. entering it on the command line, but here's no built-in way of prompting for a username. There are, however, two options that I can think of which might help.

First is to write a shell wrapper - a simple script that prompts for the username to use, then passes that into the ssh command. This could be as simple as:

<pre class=command>#! /bin/sh
echo "Enter your username: "
read user
/usr/bin/ssh -l $user $1</pre>

Save this script anywhere in your $PATH then call this rather than 'ssh'.

The other option is to edit ~/.ssh/config to include the username you want to use on each host. Just add a series of lines of the form:

<pre class=command>Host your.server.net
User fred</pre>

Now when you 'ssh your.server.net', ssh will log in using the username 'fred' rather than your current username.
This option is useful if there's a username you always use for specific servers that's different from your local username. It doesn't manage the prompt issue but it might be what you're after.

Feb 13, 2007 9:52 PM in response to Yndoendo

if the short user login name on the account of the computer that you are physically on and currently logged into is the same as the short user login name of the computer that is the ssh server that you are trying to connect to, you can do exactly what you are trying to do, you don't need the "-l" user" option or the "user@" prefix.





(if this solves your problem, or is actually helpful towards arriving at a solution to your problem, please consider clicking on either the gold or green star above in order to mark this reply as "helpful" or "solved")

SSH Annoyances

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.