PDA

View Full Version : Ssh




purduematt
Sep 24, 2002, 04:31 PM
I need to access a server via SSH. What client does anyone recommend for os X? Thanks for the help,

matt



evildead
Sep 24, 2002, 05:13 PM
it comes with OS X


just open the terminal and type


# ssh <host IP>

were you looking for a GUI client? I have never used one but I know ther are some for OS X. go to www.versiontracker.com and do a search for ssh

-evildead

purduematt
Sep 24, 2002, 06:23 PM
no, i wasn't looking for a gui ssh. this is the first time i've had to connect to a server via ssh, and really didn't know exactly how to start.

i tried the command you gave me, but i get a message saying "Missing name for redirect"

what form does the host name need to be in...do i need to include the <> or http:// or anything?

thanks for you help, i do appreciate it greatly,

matt

peterjhill
Sep 24, 2002, 06:46 PM
Are you entering the command into internet explorer? As an FYI, the Internet has been around along time, longer than Marc Andressen made mosaic, or Tim Berners-Lee created the HTTP protocol.

To be more specific about what you need to do:
Go to Applications -> Utilities

There is an application named terminal. What you should do is drag the icon to the dock, so that you will have easy access to it. Chances are you will use it fairly often in college.

So once it opens up, you will get a "terminal prompt" It will look something like this:

Last login: Tue Sep 24 17:06:13 on console
Welcome to Darwin!
[Titan:~] phill%

Except that instead of Titan, it will have your computer's name, and instead of phill, it will have the short version of your user name.

Now figure out what the name of the computer you want to connect to is.
It might be something like "unix.college.edu"
Then you need your username for the machine you are trying to connect to, something like "phill" You better know it, oh yeah, you will need a password also.

In the example below:
username = your username
unix.college.edu = the name of the machine you are connecting to
Next, type the following and then press return:
ssh username@unix.college.edu

You will probably get a message about do you trust this machine, and it will display a long string of hexadecimal. This is the "fingerprint" of the machine you are trying to connect you. Once you hit enter, for yes, your computer will then store the public key of the server you are connecting to in a hidden file in your home directory. If you want to see what is in it, type the following into the terminal window:
less ~/.ssh/known_hosts

Good luck!

purduematt
Sep 24, 2002, 07:35 PM
thanks for the very explicit help, that's pretty much what i needed. i was typing the commands in the terminal, i just wasn't sure what to enter as the host.

thanks for the help...

matt

evildead
Sep 24, 2002, 07:41 PM
for more info you can do a man on ssh

# man ssh

There is another utility called scp its like ftp but its secure. If you need to transfer files to system that your logging into with ssh, chances are you cant use ftp to do it.

purduematt
Sep 24, 2002, 07:50 PM
i have another somewhat related question...

i was reading some of the information i was given about acces to the departmental server at school via ssh, and it said that it was possible get my email if i connect via ssh to the server by forwarding the ports. is this possible to do from terminal? currently i just use a webmail interface, and it would be nice to dowload my email to mail or entourage.

thanks again,

matt

ryme4reson
Sep 24, 2002, 08:44 PM
Thanks PeterHill. I was trying to connect via ssh, and I ddint know the syntax to connect with my user name @ school, not my local computer username. Everything seems to work great. I was using telnet in terminal, but I guess the difference is ssh is secure correct? Lastly, I am taking an intro to Unix class, and I was wondering if anyone knows how to change permissions. I cp the greensheet "class info" from the instructor folder to mine, but when I try to open it I get
bash: ./greensheet: Permission denied

when I ls -l I get
-rw-r--r-- 1 jpk59629 unixStud 7339 Sep 23 22:54 BEGINNING-ASSIGNMENT
-rw-r--r-- 1 jpk59629 unixStud 6364 Sep 23 22:58 greensheet
drwxr-xr-x 3 jpk59629 unixStud 4096 Sep 23 22:25 public_html
-rw-r--r-- 1 jpk59629 unixStud 6364 Sep 24 16:06 thegreensheet

I even tried to cp with a new name "thegreensheet" I am going to read up on permissions, but looking quickly, I should be able to open these files right? Thanks for the help this far.

ryme4reson
Sep 24, 2002, 08:47 PM
I just used the pr command, and I was able to print the greensheet to the display, how do I print it any1? lpr? I tried last night and it didnt work

evildead
Sep 24, 2002, 11:00 PM
You have to be root to chage permissons.. or the owner of the file. Here are some commands to get you started.


#chmod 777 filename

will give every one permision for rwx

#chown userName filename

will change the owner

#chgrp groupName

will chage the group

Do you know the binary system? I can expaline why 777 would give permissions to every one if you do.

Owner | group | World
rwx rwx rwx
111 111 111
7 7 7

do a man on any of the comands to get more info


# man chmod


-evildead

sparkleytone
Sep 24, 2002, 11:05 PM
Originally posted by ryme4reson
Thanks PeterHill. I was trying to connect via ssh, and I ddint know the syntax to connect with my user name @ school, not my local computer username. Everything seems to work great. I was using telnet in terminal, but I guess the difference is ssh is secure correct? Lastly, I am taking an intro to Unix class, and I was wondering if anyone knows how to change permissions. I cp the greensheet "class info" from the instructor folder to mine, but when I try to open it I get
bash: ./greensheet: Permission denied

when I ls -l I get
-rw-r--r-- 1 jpk59629 unixStud 7339 Sep 23 22:54 BEGINNING-ASSIGNMENT
-rw-r--r-- 1 jpk59629 unixStud 6364 Sep 23 22:58 greensheet
drwxr-xr-x 3 jpk59629 unixStud 4096 Sep 23 22:25 public_html
-rw-r--r-- 1 jpk59629 unixStud 6364 Sep 24 16:06 thegreensheet

I even tried to cp with a new name "thegreensheet" I am going to read up on permissions, but looking quickly, I should be able to open these files right? Thanks for the help this far.

first of all the file "greensheet" isnt an executable file, as indicated by the rw-r-r. if its just a file you are trying to edit/view...try "pico greensheet" or "emacs greensheet"

sparkleytone
Sep 24, 2002, 11:06 PM
ummm wtf happened here??

ryme4reson
Sep 24, 2002, 11:11 PM
I will try to open in with pico or emacs. I think in this class we are only going to cover vi, but I will try the others also. What I ended up doing was emailing it to my .mac account. From there I printed it.

mmcneil
Sep 24, 2002, 11:36 PM
Originally posted by purduematt
i have another somewhat related question...

i was reading some of the information i was given about acces to the departmental server at school via ssh, and it said that it was possible get my email if i connect via ssh to the server by forwarding the ports. is this possible to do from terminal? currently i just use a webmail interface, and it would be nice to dowload my email to mail or entourage.

thanks again,

matt

Yes you need to change ports - this is a script i use for port forwarding, you need to do this with sudo or as root.

ssh -g -L 110:128.33.250.5:110 -L 25:128.33.250.5:25 -L 80:127.0.0.1:80 -L 443:127.0.0.1:443 -l mmcneil ssh.bbn.com

each -L is in the format of PORT:IP:PORT this actually allows you to do some very interesting things with ports which is beyond this discussion. The IP number is the number of the mail host in the case of email and localhost (127.0.0.1) in the case of the browser. You then have to make changes to your email account in your email program to use localhost (127.0.0.1) as your smtp and pop server. 110 and 25 control POP email, 80 is for your browser, 443 is for https. -l is the login name and the host. In the example shown, this resulted in a password prompt.

good luck

ryme4reson
Sep 25, 2002, 03:16 AM
Can someone help me with printing from my school computer to my local printer. I keep trying to print, and I think I am printing at school, and not here at my desk. I am using telnet. We have not discussed printing but he assumes we are doing the assignments at school so it would not be an issue to most students. Thanks to the macrumor fam for all these answers. Soon these *nix people will have to start charging for these tutoring sessions. :)

peterjhill
Sep 25, 2002, 07:58 AM
Originally posted by ryme4reson
Can someone help me with printing from my school computer to my local printer. I keep trying to print, and I think I am printing at school, and not here at my desk. I am using telnet. We have not discussed printing but he assumes we are doing the assignments at school so it would not be an issue to most students. Thanks to the macrumor fam for all these answers. Soon these *nix people will have to start charging for these tutoring sessions. :)

First off, learn about 'less' less is a program that allows you to view a file. If I want to view the file 'greensheet' I would type
less greensheet
You can then page up and down through the doc, and press 'q' when you're done.
Another cool thing you can do is while you are viewing the document press the '/' key (without the quotes of course) then type in a word that you are looking for, and press enter, it will jump to the first occurance and highlight all the occurances.

About printing, here is the secret. Find out the name of the printer you are trying to print to. If your school is any good, it will have the name of the printer near the device. Connect to one of the school unix machines that has printers configured. Then type
less /etc/printcap
You will get a long output of printers configured on that machine. Use the '/' above and type in part of the name of the printer. It is case sensitive. Here is an example from one of mine below: [Comments in brackets]
printer:\
:sd=/usr/spool/lpd/printer:\
:lp=@printer.school.edu/hpjetdirect:\
:sb:\
:rm=spool.school.edu:rp=printer:\ [printer's address][queue name]
:ka=waldec:\
:lf=/usr/spool/lpd/printer.log:\
:qe#0:\
:af=/usr/spool/lpd/printer/.logs/printer.acc:\
:if=/usr/local/lib/lpd.filters/psfilts/ifhpif:\
:of=/usr/local/lib/lpd.filters/psfilts/ifhpof:\
:gf=/usr/local/lib/lpd.filters/psfilts/ifhpgf:\
:nf=/usr/local/lib/lpd.filters/psfilts/ifhpnf:\
:tf=/usr/local/lib/lpd.filters/psfilts/ifhptf:\
:rf=/usr/local/lib/lpd.filters/psfilts/ifhprf:\
:vf=/usr/local/lib/lpd.filters/psfilts/ifhpvf:\
:cf=/usr/local/lib/lpd.filters/psfilts/ifhpcf:\
:df=/usr/local/lib/lpd.filters/psfilts/ifhpdf:\
:mx#0:

I have changed the names to protect the innocent ;-)

No open Applications -> Utilities -> Print Center
Then click the add button:
In the pop up window, select IP Printing.
In the comments above you will see where to get the info:
Printer's Address : spool.school.edu
Uncheck use default queue and then enter
Queue Name: printer
Then figure out the printer model by looking at the printer, and select something as close as possible to the printer.

Then click the add button. Another thing to do, is see if the help center at your school, or the computer clusters have any written documentation that will tell you how to do it. Also, check to see if they have a help center phone number. If they do, they can probably walk you through setting up printers and email very quickly, since they probably do it very often.

Good luck! Look for the book, Learning Unix for Mac OS X. I think it would be a great book for you. Go to www.ora.com and look it up. They will even have a sample chapter you can read. It will get you up to snuff quickly.

purduematt
Sep 28, 2002, 05:15 PM
mmcneil thanks for the info about forwarding ports. however, i don't know the ip of the server, just the domain name. is it possible to use this command if I only know the domain name?

thanks,

matt

purduematt
Sep 28, 2002, 05:36 PM
...and one last question,

do i have to retype the command to forward the ports each time i ssh into the server? or is there a way to recall the settings, or do it more quickly each time?

thanks,

matt

purduematt
Sep 28, 2002, 05:54 PM
when i try to forward the ports when connected via ssh is that that ports can only be forwarded by root. how do i log in as root to forward the ports?

thanks again,

matt

mmcneil
Sep 29, 2002, 04:16 PM
To avoid being root, you must use the command "sudo" it requires an Admin password. Gives you the power of root - so be careful :).

Billicus
Oct 9, 2002, 09:21 PM
Can someone please help me, plz. :( I'm trying to login into my school unix server (Redhat Linux) from OS X, at home, but when I try "telnet" and my hostname, it waits a bit and says I was disconnected by a foriegn host. I've tried "rlogin" and "ssh" to no avail also. Plz help me.

ryme4reson
Oct 9, 2002, 09:27 PM
I have to telnet or ssh into school which runs redhat. This is exactly what I type

first
user name jpk59629
passwords *******

I type

ssh jpk59629@voyager.deanza.fhda.edu (return)

Thast it, then it should prompt for password. If that doesnt work, make sure you are trying the right address ie. deanza.edu versus deanza.fhda.edu

Good Luck!

Billicus
Oct 9, 2002, 09:38 PM
port 22: Connection refused is what I get when I try what you said. what was that part about username password etc. though? Is that your login name to os X? because my school acount's name is different from my shortname @ home.

It's confusing! :rolleyes:

ryme4reson
Oct 9, 2002, 09:58 PM
Is the username you have on the computer you are trying to access. You OSX username has nothing to do with this. Consider your machine at home just a terminal to the machine @ school. But it sounds like you are having problems getting out or in2 the other computer, not a login prob. I dont know how much I can help. Sorry

beatle888
Oct 9, 2002, 10:37 PM
bill maybe you have firewall on...would this
cause a problem if you do?

madamimadam
Oct 9, 2002, 10:41 PM
Originally posted by purduematt
i have another somewhat related question...

i was reading some of the information i was given about acces to the departmental server at school via ssh, and it said that it was possible get my email if i connect via ssh to the server by forwarding the ports. is this possible to do from terminal? currently i just use a webmail interface, and it would be nice to dowload my email to mail or entourage.

thanks again,

matt

Are you sure you need to SSH and not just SSL? SSH sounds like a lot of security for a school email server.

Billicus
Oct 10, 2002, 05:49 PM
Originally posted by beatle888
bill maybe you have firewall on...would this
cause a problem if you do?

No, that wasn't the problem. The problem was this: the school red hat linux server was set to deny requests from unfamiliar IP adresses. All my teacher had to do was insert my IP address into the server, and I was able to access it tonight. :D

evildead
Oct 10, 2002, 06:33 PM
Originally posted by Billicus


No, that wasn't the problem. The problem was this: the school red hat linux server was set to deny requests from unfamiliar IP adresses. All my teacher had to do was insert my IP address into the server, and I was able to access it tonight. :D

... so the firewall running on the Linux box needed to have a rule put in with your IP.. or they did something funny with SSH and known user Certs...

its still a firewall... but at least you got in. Seems like some over kill on security for a EDU.. oh well

Billicus
Oct 10, 2002, 07:45 PM
Originally posted by evildead


... so the firewall running on the Linux box needed to have a rule put in with your IP.. or they did something funny with SSH and known user Certs...

its still a firewall... but at least you got in. Seems like some over kill on security for a EDU.. oh well

We were hacked last year, bringing down the entire linux server for two weeks, so this isn't exactly overkill.

ryme4reson
Oct 10, 2002, 08:14 PM
What about Dynamic IP address? I mean most people dont have an IP address, they use dynamics