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 > Correct way to log out of a ssh session.

Correct way to log out of a ssh session.
Thread Tools
real
Grizzled Veteran
Join Date: May 2001
Location: Ca
Status: Offline
Reply With Quote
Mar 24, 2003, 07:08 PM
 
Hows it going I just got ssh going on a server I run for backups and other things(mostly stuff I need but dont want it on my powerbook. I have been able to connect to the server via ssh but I have a weird feeling that just quitting the terminal or closeing that terminal window doesn't do the right thing to close that session(maybe not). Any help would be great.

Second part of the question,
I want to be able to ssh into the server from say work, I have a router so I need to open a port for ssh, which is that, also I would like to FTP in to the server from a remote location. any thoughts on that would be great.
Thanks for the time
REAL
With some loud music + a friend to chat nearby you can get alot done. - but jezz, I'd avoid it if I had the choice---- If only real people came with Alpha Channels.......:)
AIM:xflaer
deinterlaced.com
     
EnVoy
Mac Enthusiast
Join Date: Dec 2002
Location: Newport Beach, CA
Status: Offline
Reply With Quote
Mar 24, 2003, 07:18 PM
 
Hows it going I just got ssh going on a server I run for backups and other things(mostly stuff I need but dont want it on my powerbook. I have been able to connect to the server via ssh but I have a weird feeling that just quitting the terminal or closeing that terminal window doesn't do the right thing to close that session(maybe not). Any help would be great.
type:

logout

Also type 'logout' before you close/quit the terminal

Second part of the question,
I want to be able to ssh into the server from say work, I have a router so I need to open a port for ssh, which is that, also I would like to FTP in to the server from a remote location.
look here

ssh is port 22
     
kcm3
Junior Member
Join Date: Apr 2000
Location: Durham, NC
Status: Offline
Reply With Quote
Mar 24, 2003, 07:24 PM
 
Typing "exit" at the remote prompt that you get from an ssh session will close your session and return you to your local shell. Closing your terminal window will end your session just as well, though.

As for remote access, you would need to open up port 22 on your router. I would recommend using scp for your remote file transfer needs instead of ftp. It also runs on port 22, since it is a function of ssh.

However, if you want to use ftp, you will want to open up port 23.

Kyle
     
Paul McCann
Mac Enthusiast
Join Date: Nov 2001
Location: Adelaide, South Australia
Status: Offline
Reply With Quote
Mar 24, 2003, 08:26 PM
 
One thing to note re the "close window" or "type exit" choices: I'm pretty sure that simply closing the window won't allow your command history to be written to the appropriate file, while typing "exit" (or "logout") will. If you want to revisit your command lines then this might be a good reason to use the "exit" approach.

(This behaviour will probably vary shell to shell: my memory is welded to tcsh's behaviour, but my heart belongs to zsh, which has a better approach to command line history.)

Cheers,
Paul
     
pimephalis
Dedicated MacNNer
Join Date: Nov 2002
Location: Rouge River
Status: Offline
Reply With Quote
Mar 24, 2003, 08:26 PM
 
Originally posted by EnVoy:
[B]type:

logout

Also type 'logout' before you close/quit the terminal
Or even better, type control-d. A nice shortcut.
Swimming upstream since 1994.
     
real  (op)
Grizzled Veteran
Join Date: May 2001
Location: Ca
Status: Offline
Reply With Quote
Mar 24, 2003, 11:20 PM
 
Originally posted by EnVoy:
type:

logout

Also type 'logout' before you close/quit the terminal



look here

ssh is port 22

Thanks for the info and the link. Have a good one
REAL
With some loud music + a friend to chat nearby you can get alot done. - but jezz, I'd avoid it if I had the choice---- If only real people came with Alpha Channels.......:)
AIM:xflaer
deinterlaced.com
     
Rainy Day
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
Mar 25, 2003, 01:01 AM
 
ftp sends your password in the clear (not good). sftp is an ftp-like protocol, except that it's secure. Fugu is a free, open source, GUI file transfer client. Still in beta, and a little quirky, but it gets the job done.

Also, you might want to look at rsync, which can move files via an ssh tunnel.

Edit: For clarity.
( Last edited by Rainy Day; Mar 29, 2003 at 01:04 PM. )
     
Camelot
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Mar 25, 2003, 02:32 AM
 
Originally posted by kcm3:
However, if you want to use ftp, you will want to open up port 23.
Oops, no.

Port 23 is telnet

FTP uses ports 20 and 21

For a complete list of the standard ports, check the services list.
Gods don't kill people - people with Gods kill people.
     
kcm3
Junior Member
Join Date: Apr 2000
Location: Durham, NC
Status: Offline
Reply With Quote
Mar 25, 2003, 10:12 AM
 
Originally posted by Camelot:
Oops, no.

Port 23 is telnet

FTP uses ports 20 and 21

For a complete list of the standard ports, check the services list.

whoops, yep. brain fart. that'll teach me to re-read my posts, huh?
     
diamondsw
Senior User
Join Date: Apr 2000
Location: Woodridge, IL
Status: Offline
Reply With Quote
Mar 28, 2003, 03:26 PM
 
Originally posted by Camelot:
Oops, no.

Port 23 is telnet

FTP uses ports 20 and 21

For a complete list of the standard ports, check the services list.
FTP only uses that for the control connection - the data connection uses random high ports.

If you want the FTP session encrypted, I strongly recommend using either sftp or ftp-ssl, and not to try to run plain FTP through SSH. It's very difficult to begin with, and bugs in OS X's FTP server (lukemftpd) cause problems with passive port ranges (those who know what's involved with FTP through SSH will understand).
     
gatorparrots
Dedicated MacNNer
Join Date: Dec 2002
Location: someplace
Status: Offline
Reply With Quote
Apr 3, 2003, 05:10 PM
 
Originally posted by diamondsw:
FTP only uses that for the control connection - the data connection uses random high ports.
Not exactly true. On the server end, ctive mode FTP uses port 21 for the control connection, port 20 for the data connection. On the client end of things, a random port (n) > 1024 is chosen for the command connection, and (n+1) for the data connection

Passive mode uses port 21 for the command connection, then chooses a random port > 1024 for data. The client uses a random port (n) > 1024 for the command connection and n+1 for data.

For diagrams and a more in-depth explanation see this link:
Active FTP vs. Passive FTP, a Definitive Explanation
http://slacksite.com/other/ftp.html
     
Welnic
Forum Regular
Join Date: Nov 2002
Location: Santa Barbara CA
Status: Offline
Reply With Quote
Apr 3, 2003, 08:41 PM
 
Originally posted by Paul McCann:
One thing to note re the "close window" or "type exit" choices: I'm pretty sure that simply closing the window won't allow your command history to be written to the appropriate file, while typing "exit" (or "logout") will. If you want to revisit your command lines then this might be a good reason to use the "exit" approach.

(This behaviour will probably vary shell to shell: my memory is welded to tcsh's behaviour, but my heart belongs to zsh, which has a better approach to command line history.)

Cheers,
Paul
If I am running something on one of my linux boxes in the background, say I had to start up distributed folding by hand, and I just close the window it kills those background processes. If I type exit then they continue to run.

And I use and like scp for copying things between machines.
     
Mithras
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
Apr 4, 2003, 08:12 AM
 
Incidentally, to be able to start an *interactive* process via SSH, then disconnect and be able to reattach to it later, check out screen, which is built-in to Linux, BSD, and OS X.
     
   
 
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 02:12 AM.
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.,