Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > ssh'ing w/out a username?

ssh'ing w/out a username?
Thread Tools
ndpatel
Fresh-Faced Recruit
Join Date: Nov 1999
Location: chicago. il, usa
Status: Offline
Reply With Quote
Oct 18, 2001, 12:49 AM
 
hey--
i live with a bunch of roomates, and since my g4 is always connected (ahhh-DSL) they're always using it to ssh into the campus network and check their mail.

in OS9, i just left an alias of niftytelnet in a corner and they were happy. it even brought up a little dialog box for them to do kerberos if they wanted to.

i was all excited when i installed 10.1 b/c i thought i could just leave terminal in the dock, and then just have them type 'ssh harper.uchicago.edu' (which i think everybody at chicago can do in their sleep ) and all would be well.

but that doesn't work, because ssh takes my username on my mac and sends it to the server as the login name, which is just stupid. i realize that ssh -l [username] harper.uchicago.edu would work, but i want something elegant (and that i don't have to explain). is there a switch i can add? because then i can just alias ssh to ssh -[switch] and all will be well.

thanks for the help!
--nilay
     
johann
Forum Regular
Join Date: Nov 2000
Location: Seattle, Wa, USA
Status: Offline
Reply With Quote
Oct 18, 2001, 01:23 AM
 
i think it just as simple as telling them to type ssh [email protected] or... you can set up aliases for that command. so if you got 3 users, jim, jane, and jason, you can set up an alias in your .cshrc file like this:

alias jim 'ssh [email protected]'
alias jane 'ssh [email protected]'
alias jason 'ssh [email protected]'

now everytime they goto the terminal they can just type thier name.. or whatever...

good luck
     
Gary Kerbaugh
Dedicated MacNNer
Join Date: Jul 2001
Location: NC
Status: Offline
Reply With Quote
Oct 18, 2001, 01:47 AM
 
   Since the usernames each of your roommates will have to be in the ssh invocation, they would have to enter some unique parameter in order to distinguish them, like say their initials. You could write a brief shell script with an if statement for each roommate that checked the argument for their identifier. Within each if block, you could put the ssh invocation with the corresponding username.
   However, why not put all of the other information into an alias and have them type the name of the alias followed by their username. Try, for instance:

alias U_Chi_ssh 'ssh -l \!:1 harper.uchicago.edu'

Of course, they would probably prefer you shortened the name of the alias, but you get the idea. I hope that I understood your question correctly. You obviously know about aliases so I hope that I'm not suggesting something that you've already thought of.
Gary
A computer scientist is someone who, when told to "Go to Hell", sees the
"go to", rather than the destination, as harmful.
     
fitter
Senior User
Join Date: Jan 2000
Status: Offline
Reply With Quote
Oct 18, 2001, 02:31 AM
 
Good suggestions above.

The elegant way to pass a username with ssh is:

<font face = "courier">user% ssh [email protected]
[email protected]'s password:
Boo!
fitter$</font>

No need for the <font face = "courier">-l</font> option. Just ssh username@hostname will do it.
     
ndpatel  (op)
Fresh-Faced Recruit
Join Date: Nov 1999
Location: chicago. il, usa
Status: Offline
Reply With Quote
Oct 18, 2001, 02:45 AM
 
thanks for all the help!

after thinking about it some more, i'm beginning to see that i _have_ to send the username out with the ssh session initiation.
so i guess what i'm really after is what the campus SunRay's have on them, which is basically a script that runs when someone types ssh that asks for your username, and then does the work of typing username@host for you.

so assuming i can do this in a tcsh script, what i'm looking for is a script i can alias to the 'ssh harper' command (we'll call it ssh+) which would essentially consist of:

echo 'what is your username?'
(username)=&gt;username
ssh [email protected]

so what i need help with is the input of the username and the use of that variable. any ideas?

thanks again--
nilay
     
IEEE1394
Mac Enthusiast
Join Date: Dec 2000
Status: Offline
Reply With Quote
Oct 18, 2001, 06:05 AM
 
Try this. I have not tested it so don't beat me if it don't work and all your files are deleted .

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
#!/bin/sh
if [ $# == <font color = blue>1</font> ]
then
ssh $<font color = blue>1</font>@harper.uchicago.edu
else
if [ $# == <font color = blue>0</font> ]
then
echo <font color = red>"You must enter a username."</font>
else
echo <font color = red>"Two usernames? Confusing. Please enter only one."</font>
fi
fi
</font>[/code]

Enter that code in your favourite editor (go pico) and then save it in /usr/bin as something to do with ssh (e.g. sshu, ssu, myssh). When your roommates want to connect, all they have to do is type '&lt;filename&gt; &lt;username&gt;', e.g
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>% myssh bob </font>[/code]

This will connect 'bob' to your ssh server.

Hope it works. Enjoy.
     
kangoo_boo
Dedicated MacNNer
Join Date: May 2001
Location: Paris, France
Status: Offline
Reply With Quote
Oct 18, 2001, 08:41 AM
 
# ssh localhost -l bob
also works
hotline://hl.chatonly.org
mp3://radio.chatonly.org
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 05:22 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,