Ssh

Discussion in 'Mac Help/Tips' started by purduematt, Sep 24, 2002.

  1. purduematt macrumors newbie

    Joined:
    Jul 17, 2002
    #1
    I need to access a server via SSH. What client does anyone recommend for os X? Thanks for the help,

    matt
     
  2. evildead macrumors 65816

    evildead

    Joined:
    Jun 18, 2001
    Location:
    WestCost, USA
    #2
    you all ready have a client

    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
     
  3. purduematt thread starter macrumors newbie

    Joined:
    Jul 17, 2002
    #3
    ssh

    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
     
  4. peterjhill macrumors 65816

    peterjhill

    Joined:
    Apr 25, 2002
    Location:
    Seattle, WA
    #4
    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!
     
  5. purduematt thread starter macrumors newbie

    Joined:
    Jul 17, 2002
    #5
    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
     
  6. evildead macrumors 65816

    evildead

    Joined:
    Jun 18, 2001
    Location:
    WestCost, USA
    #6
    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.
     
  7. purduematt thread starter macrumors newbie

    Joined:
    Jul 17, 2002
    #7
    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
     
  8. ryme4reson macrumors 6502

    Joined:
    Mar 5, 2002
    Location:
    Cupertino CA
    #8
    I needed help also

    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.
     
  9. ryme4reson macrumors 6502

    Joined:
    Mar 5, 2002
    Location:
    Cupertino CA
    #9
    I figured it out somewhat

    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
     
  10. evildead macrumors 65816

    evildead

    Joined:
    Jun 18, 2001
    Location:
    WestCost, USA
    #10
    Re: ryme4reson

    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
     
  11. sparkleytone macrumors 68020

    sparkleytone

    Joined:
    Oct 28, 2001
    Location:
    Greensboro, NC
    #11
    Re: I needed help also

    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"
     
  12. sparkleytone macrumors 68020

    sparkleytone

    Joined:
    Oct 28, 2001
    Location:
    Greensboro, NC
    #12
    Re: Re: I needed help also

    ummm wtf happened here??
     
  13. ryme4reson macrumors 6502

    Joined:
    Mar 5, 2002
    Location:
    Cupertino CA
    #13
    Thanks

    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.
     
  14. mmcneil macrumors regular

    Joined:
    Sep 4, 2001
    Location:
    San Diego, CA
    #14
    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
     
  15. ryme4reson macrumors 6502

    Joined:
    Mar 5, 2002
    Location:
    Cupertino CA
    #15
    Printer Setup

    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. :)
     
  16. peterjhill macrumors 65816

    peterjhill

    Joined:
    Apr 25, 2002
    Location:
    Seattle, WA
    #16
    Re: Printer Setup

    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:\
    :eek:f=/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.
     
  17. purduematt thread starter macrumors newbie

    Joined:
    Jul 17, 2002
    #17
    forwarding ports

    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
     
  18. purduematt thread starter macrumors newbie

    Joined:
    Jul 17, 2002
    #18
    one last question

    ...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
     
  19. purduematt thread starter macrumors newbie

    Joined:
    Jul 17, 2002
    #19
    maybe one more question...

    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
     
  20. mmcneil macrumors regular

    Joined:
    Sep 4, 2001
    Location:
    San Diego, CA
    #20
    sudo Baby

    To avoid being root, you must use the command "sudo" it requires an Admin password. Gives you the power of root - so be careful :).
     
  21. Billicus macrumors 6502a

    Billicus

    Joined:
    Apr 3, 2002
    Location:
    Charles City, Iowa
    #21
    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.
     
  22. ryme4reson macrumors 6502

    Joined:
    Mar 5, 2002
    Location:
    Cupertino CA
    #22
    I do the same thing from home

    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!
     
  23. Billicus macrumors 6502a

    Billicus

    Joined:
    Apr 3, 2002
    Location:
    Charles City, Iowa
    #23
    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:
     
  24. ryme4reson macrumors 6502

    Joined:
    Mar 5, 2002
    Location:
    Cupertino CA
    #24
    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
     
  25. beatle888 macrumors 68000

    beatle888

    Joined:
    Feb 3, 2002
    #25
    bill maybe you have firewall on...would this
    cause a problem if you do?
     

Share This Page