|
|
ssh'ing w/out a username?
|
|
|
|
Fresh-Faced Recruit
Join Date: Nov 1999
Location: chicago. il, usa
Status:
Offline
|
|
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
|
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Nov 2000
Location: Seattle, Wa, USA
Status:
Offline
|
|
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
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Jul 2001
Location: NC
Status:
Offline
|
|
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.
|
|
|
|
|
|
|
|
Senior User
Join Date: Jan 2000
Status:
Offline
|
|
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.
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Nov 1999
Location: chicago. il, usa
Status:
Offline
|
|
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)=>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
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Dec 2000
Status:
Offline
|
|
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 '<filename> <username>', 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.
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: May 2001
Location: Paris, France
Status:
Offline
|
|
# ssh localhost -l bob
also works
|
hotline://hl.chatonly.org
mp3://radio.chatonly.org
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|